Skip to content

Conversation

@ehhuang
Copy link
Contributor

@ehhuang ehhuang commented Jan 30, 2025

What does this PR do?

Adds non-streaming support for agent.create_turn, which returns the turn object and user can access the output_message like so:

response = rag_agent.create_turn(
    messages=[{"role": "user", "content": prompt}],
    session_id=session_id,
    stream=False,
)
response.output_message

Test Plan

Modified hello.py example to use stream=False and print output_message.

Sources

Please link relevant resources if necessary.

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.
  • Read the contributor guideline,
    Pull Request section?
  • Updated relevant documentation.
  • Wrote necessary unit or integration tests.

# What does this PR do?

Adds non-streaming support for agent.create_turn, which returns the turn object and user can access the output_message like so:

```
response = rag_agent.create_turn(
    messages=[{"role": "user", "content": prompt}],
    session_id=session_id,
    stream=False,
)
response.output_message
```


## Test Plan

Modified hello.py example to use stream=False and print output_message.

## Sources

Please link relevant resources if necessary.


## 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.
- [ ] 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.
Copy link
Contributor

@ashwinb ashwinb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg!

@ashwinb ashwinb requested a review from subramen January 30, 2025 21:13
@ashwinb
Copy link
Contributor

ashwinb commented Jan 30, 2025

@subramen finally!

@ehhuang ehhuang merged commit 0be2852 into main Jan 30, 2025
3 checks passed
@ehhuang ehhuang deleted the pr107 branch January 30, 2025 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants