Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/celeste/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,11 @@ def __call__(self, value: list) -> list:
"""Validate tools list against supported tools."""
for item in value:
if isinstance(item, Tool) and type(item) not in self.tools:
supported = [t.__name__ for t in self.tools]
msg = f"Tool '{type(item).__name__}' not supported. Supported: {supported}"
if self.tools:
supported = [t.__name__ for t in self.tools]
msg = f"Tool '{type(item).__name__}' not supported. Supported: {supported}"
else:
msg = f"Tool '{type(item).__name__}' is not supported by this model"
raise ConstraintViolationError(msg)
return value

Expand Down
2 changes: 1 addition & 1 deletion src/celeste/protocols/chatcompletions/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def map(
if isinstance(item, Tool):
mapper = dispatch.get(type(item))
if mapper is None:
msg = f"Tool '{type(item).__name__}' is not supported by this provider"
msg = f"Tool '{type(item).__name__}' is not supported by Chat Completions"
raise ValueError(msg)
tools.append(mapper.map_tool(item))
elif isinstance(item, dict) and "name" in item:
Expand Down
Loading