fix(llm): use anthropic.Omit instead of NotGiven for tools parameter

The Anthropic SDK messages.create expects Omit (not NotGiven) for the
tools parameter. Use anthropic.omit sentinel value to match the expected type.
This commit is contained in:
Bentlybro
2026-03-02 11:27:39 +00:00
parent 83b3214912
commit 3cb8f47b62

View File

@@ -407,12 +407,12 @@ class LLMResponse(BaseModel):
def convert_openai_tool_fmt_to_anthropic(
openai_tools: list[dict] | None = None,
) -> Iterable[ToolUnionParam] | anthropic.NotGiven:
) -> Iterable[ToolUnionParam] | anthropic.Omit:
"""
Convert OpenAI tool format to Anthropic tool format.
"""
if not openai_tools or len(openai_tools) == 0:
return anthropic.NOT_GIVEN
return anthropic.omit
anthropic_tools = []
for tool in openai_tools: