Skip to content

Commit

Permalink
Agent response format (#660)
Browse files Browse the repository at this point in the history
# What does this PR do?

Add response format for agents structured output.

- [ ] Using structured output for agents (interior_design app as an
example) (#issue)
meta-llama/llama-stack-apps#122


## Test Plan
E2E test plan with llama-stack-apps interior_design

Please describe:
 Test ran: 

 - provide instructions so it can be reproduced.
 Start your distro:
llama stack run llama_stack/templates/fireworks/run.yaml --env
FIREWORKS_API_KEY=<API_KEY>
 
Run api test:
```PYTHONPATH=. python examples/interior_design_assistant/api.py localhost 5000 examples/interior_design_assistant/resources/documents/ examples/interior_design_assistant/resources/images/fireplaces```


## Sources
Results: 
meta-llama/llama-stack-client-python#72

## Before submitting

- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Ran pre-commit to handle lint / formatting issues.
- [x] Read the [contributor guideline](https://github.com/meta-llama/llama-stack/blob/main/CONTRIBUTING.md),
      Pull Request section?
- [ ] Updated relevant documentation.
- [ ] Wrote necessary unit or integration tests.
  • Loading branch information
hanzlfs authored Jan 28, 2025
1 parent e4865c3 commit 229f0d5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions llama_stack/apis/agents/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class AgentConfig(AgentConfigCommon):
model: str
instructions: str
enable_session_persistence: bool
response_format: Optional[ResponseFormat] = None


class AgentConfigOverridablePerTurn(AgentConfigCommon):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ async def _run(
if tool_to_group.get(tool.tool_name, None) != RAG_TOOL_GROUP
],
tool_prompt_format=self.agent_config.tool_prompt_format,
response_format=self.agent_config.response_format,
stream=True,
sampling_params=sampling_params,
):
Expand Down

0 comments on commit 229f0d5

Please sign in to comment.