-
Notifications
You must be signed in to change notification settings - Fork 912
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
fix(test): update client-sdk tests to handle tool format parametrization better #1287
Conversation
type="text", | ||
text=content, | ||
) | ||
return content | ||
elif isinstance(content, TextContentItem): | ||
return OpenAIChatCompletionContentPartTextParam( |
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.
actually there is a tricky bug here also. our InterleavedContent
type is Union[str, InterleavedContentItem, List[InterleavedContentItem]
but OpenAI's does not have the second piece. this method (at the end), needs to wrap the value into an array if it is not an instance of str
-- will fix.
tc = TestCase(test_case) | ||
|
||
response = client_with_models.inference.chat_completion( | ||
model_id=text_model_id, | ||
messages=tc["messages"], | ||
tools=tc["tools"], | ||
tool_config={"tool_choice": "none", "tool_prompt_format": provider_tool_format}, | ||
tool_config={"tool_choice": "none", "tool_prompt_format": tool_prompt_format}, |
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.
doens't just leaving this unspecified work?
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.
you mean for all these tests?
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.
yeah, jeebuz I could have avoided all this work? I feel like a doofus.
8a70887
to
6079e72
Compare
…ion better (meta-llama#1287) # What does this PR do? Tool format depends on the model. @ehhuang introduced a `get_default_tool_prompt_format` function for this purpose. We should use that instead of hacky model ID matching we had before. Secondly, non llama models don't have this concept so testing with those models should work as is. [//]: # (If resolving an issue, uncomment and update the line below) [//]: # (Closes #[issue-number]) ## Test Plan ```bash for distro in fireworks ollama; do LLAMA_STACK_CONFIG=$distro \ pytest -s -v tests/client-sdk/inference/test_text_inference.py \ --inference-model=meta-llama/Llama-3.2-3B-Instruct \ --vision-inference-model="" done LLAMA_STACK_CONFIG=dev \ pytest -s -v tests/client-sdk/inference/test_text_inference.py \ --inference-model=openai/gpt-4o \ --vision-inference-model="" ``` [//]: # (## Documentation)
What does this PR do?
Tool format depends on the model. @ehhuang introduced a
get_default_tool_prompt_format
function for this purpose. We should use that instead of hacky model ID matching we had before.Secondly, non llama models don't have this concept so testing with those models should work as is.
Test Plan