fix
This commit is contained in:
1
changelog/3234.fixed.md
Normal file
1
changelog/3234.fixed.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
- Fix a bug in LLM context audio content handling
|
||||||
@@ -87,19 +87,10 @@ class LLMContext:
|
|||||||
# Convert tools to ToolsSchema if needed.
|
# Convert tools to ToolsSchema if needed.
|
||||||
# If the tools are already a ToolsSchema, this is a no-op.
|
# If the tools are already a ToolsSchema, this is a no-op.
|
||||||
# Otherwise, we wrap them in a shim ToolsSchema.
|
# Otherwise, we wrap them in a shim ToolsSchema.
|
||||||
converted_tools: ToolsSchema | NotGiven
|
converted_tools = openai_context.tools
|
||||||
raw_tools = openai_context.tools
|
if isinstance(converted_tools, list):
|
||||||
if isinstance(raw_tools, list):
|
|
||||||
converted_tools = ToolsSchema(
|
converted_tools = ToolsSchema(
|
||||||
standard_tools=[], custom_tools={AdapterType.SHIM: raw_tools}
|
standard_tools=[], custom_tools={AdapterType.SHIM: converted_tools}
|
||||||
)
|
|
||||||
elif isinstance(raw_tools, ToolsSchema):
|
|
||||||
converted_tools = raw_tools
|
|
||||||
elif raw_tools is NOT_GIVEN:
|
|
||||||
converted_tools = NOT_GIVEN
|
|
||||||
else:
|
|
||||||
raise TypeError(
|
|
||||||
f"Unsupported tools type when converting OpenAI context: {type(raw_tools)}"
|
|
||||||
)
|
)
|
||||||
return LLMContext(
|
return LLMContext(
|
||||||
messages=openai_context.get_messages(),
|
messages=openai_context.get_messages(),
|
||||||
|
|||||||
Reference in New Issue
Block a user