Skip to content

Conversation

ehhuang
Copy link
Contributor

@ehhuang ehhuang commented Mar 11, 2025

Summary:

Includes fixes to get test_agents working with openAI model, e.g. tool parsing and message conversion

Test Plan:

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

Stack created with Sapling. Best reviewed with ReviewStack.

@ehhuang ehhuang mentioned this pull request Mar 11, 2025
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 11, 2025
Comment on lines +996 to 1002
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

Copy link
Contributor Author

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}"
)
Copy link
Contributor Author

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

@ehhuang ehhuang changed the title fix: non-llama tool extraction fix: agents with non-llama model Mar 11, 2025
@ehhuang ehhuang marked this pull request as ready for review March 11, 2025 16:47
@ehhuang ehhuang mentioned this pull request Mar 13, 2025
@ehhuang ehhuang force-pushed the pr1550 branch 2 times, most recently from b1acc52 to 9700ce6 Compare March 13, 2025 18:30
@ehhuang ehhuang force-pushed the pr1550 branch 3 times, most recently from b6ed0c5 to 87a2a56 Compare March 17, 2025 23:16
Summary:

Test Plan:
Summary:

Test Plan:
Summary:

Test Plan:
@ehhuang ehhuang merged commit c23a7af into main Mar 18, 2025
8 checks passed
@ehhuang ehhuang deleted the pr1550 branch March 18, 2025 05:11
ehhuang added a commit that referenced this pull request Mar 18, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants