-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: agents with non-llama model #1550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if isinstance(message.content, list): | ||
message.content.extend(contents) | ||
else: | ||
if isinstance(message.content, str): | ||
message.content = [TextContentItem(text=message.content)] + contents | ||
else: | ||
message.content = [message.content] + contents | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Append to user message instead since litellm requires tool responses message to follow a message with tool_call, which does make sense imo.
print(f"{i}: {m.role}: {m.content}") | ||
raise ValueError( | ||
f"Messages must alternate between user and assistant. Message {i} has the same role as message {i - 1}" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing this check as OpenAI models can output multiple tool calls
b1acc52
to
9700ce6
Compare
b6ed0c5
to
87a2a56
Compare
Summary: Test Plan: Summary: Test Plan: Summary: Test Plan:
Summary: closes #1488 Test Plan: added new integration test ``` LLAMA_STACK_CONFIG=dev pytest -s -v tests/integration/agents/test_agents.py --safety-shield meta-llama/Llama-Guard-3-8B --text-model openai/gpt-4o-mini ``` --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/meta-llama/llama-stack/pull/1556). * __->__ #1556 * #1550
Summary:
Includes fixes to get test_agents working with openAI model, e.g. tool parsing and message conversion
Test Plan:
Stack created with Sapling. Best reviewed with ReviewStack.