You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# What does this PR do?
[Provide a short summary of what this PR does and why. Link to relevant
issues if applicable.]
[//]: # (If resolving an issue, uncomment and update the line below)
[//]: # (Closes #[issue-number])
## Test Plan
[Describe the tests you ran to verify your changes with result
summaries. *Provide clear instructions so the plan can be easily
re-executed.*]
[//]: # (## Documentation)
---------
Co-authored-by: Francisco Arceo <farceo@redhat.com>
Now open up a new terminal using the same virtual environment and you can run this demo as a script using `uv run demo_script.py` or in an interactive shell.
22
+
#### Step 3: Run the demo
23
+
Now open up a new terminal and copy the following script into a file named `demo_script.py`.
24
+
25
25
```python
26
26
from llama_stack_client import Agent, AgentEventLogger, RAGDocument, LlamaStackClient
messages=[{"role": "user", "content": "How do you do great work?"}],
75
+
messages=[{"role": "user", "content": prompt}],
71
76
session_id=agent.create_session("rag_session"),
77
+
stream=True,
72
78
)
73
79
74
80
for log in AgentEventLogger().log(response):
75
81
log.print()
76
82
```
83
+
We will use `uv` to run the script
84
+
```
85
+
uv run --with llama-stack-client demo_script.py
86
+
```
77
87
And you should see output like below.
78
-
```bash
79
-
inference> [knowledge_search(query="What does it mean to do great work")]
80
-
tool_execution> Tool:knowledge_search Args:{'query': 'What does it mean to do great work'}
81
-
tool_execution> Tool:knowledge_search Response:[TextContentItem(text='knowledge_search tool found 5 chunks:\nBEGIN of knowledge_search tool results.\n', type='text'), TextContentItem(text="Result 1:\nDocument_id:docum\nContent: work. Doing great work means doing something important\nso well that you expand people's ideas of what's possible. But\nthere's no threshold for importance. It's a matter of degree, and\noften hard to judge at the time anyway.\n", type='text'), TextContentItem(text='Result 2:\nDocument_id:docum\nContent: [<a name="f1n"><font color=#000000>1</font></a>]\nI don\'t think you could give a precise definition of what\ncounts as great work. Doing great work means doing something important\nso well\n', type='text'), TextContentItem(text="Result 3:\nDocument_id:docum\nContent: . And if so\nyou're already further along than you might realize, because the\nset of people willing to want to is small.<br /><br />The factors in doing great work are factors in the literal,\nmathematical sense, and\n", type='text'), TextContentItem(text="Result 4:\nDocument_id:docum\nContent: \nincreases your morale and helps you do even better work. But this\ncycle also operates in the other direction: if you're not doing\ngood work, that can demoralize you and make it even harder to. Since\nit matters\n", type='text'), TextContentItem(text="Result 5:\nDocument_id:docum\nContent: to try to do\ngreat work. But that's what's going on subconsciously; they shy\naway from the question.<br /><br />So I'm going to pull a sneaky trick on you. Do you want to do great\n", type='text'), TextContentItem(text='END of knowledge_search tool results.\n', type='text')]
inference> [knowledge_search(query="What is the key to doing great work")]
94
+
95
+
tool_execution> Tool:knowledge_search Args:{'query': 'What is the key to doing great work'}
96
+
97
+
tool_execution> Tool:knowledge_search Response:[TextContentItem(text='knowledge_search tool found 5 chunks:\nBEGIN of knowledge_search tool results.\n', type='text'), TextContentItem(text="Result 1:\nDocument_id:docum\nContent: work. Doing great work means doing something important\nso well that you expand people's ideas of what's possible. But\nthere's no threshold for importance. It's a matter of degree, and\noften hard to judge at the time anyway.\n", type='text'), TextContentItem(text="Result 2:\nDocument_id:docum\nContent: work. Doing great work means doing something important\nso well that you expand people's ideas of what's possible. But\nthere's no threshold for importance. It's a matter of degree, and\noften hard to judge at the time anyway.\n", type='text'), TextContentItem(text="Result 3:\nDocument_id:docum\nContent: work. Doing great work means doing something important\nso well that you expand people's ideas of what's possible. But\nthere's no threshold for importance. It's a matter of degree, and\noften hard to judge at the time anyway.\n", type='text'), TextContentItem(text="Result 4:\nDocument_id:docum\nContent: work. Doing great work means doing something important\nso well that you expand people's ideas of what's possible. But\nthere's no threshold for importance. It's a matter of degree, and\noften hard to judge at the time anyway.\n", type='text'), TextContentItem(text="Result 5:\nDocument_id:docum\nContent: work. Doing great work means doing something important\nso well that you expand people's ideas of what's possible. But\nthere's no threshold for importance. It's a matter of degree, and\noften hard to judge at the time anyway.\n", type='text'), TextContentItem(text='END of knowledge_search tool results.\n', type='text')]
98
+
99
+
inference> Based on the search results, it seems that doing great work means doing something important so well that you expand people's ideas of what's possible. However, there is no clear threshold for importance, and it can be difficult to judge at the time.
100
+
101
+
To further clarify, I would suggest that doing great work involves:
102
+
103
+
* Completing tasks with high quality and attention to detail
104
+
* Expanding on existing knowledge or ideas
105
+
* Making a positive impact on others through your work
106
+
* Striving for excellence and continuous improvement
107
+
108
+
Ultimately, great work is about making a meaningful contribution and leaving a lasting impression.
82
109
```
83
110
Congratulations! You've successfully built your first RAG application using Llama Stack! 🎉🥳
84
111
@@ -92,10 +119,3 @@ Now you're ready to dive deeper into Llama Stack!
92
119
- Discover how to [Build Llama Stacks](../distributions/index.md).
93
120
- Refer to our [References](../references/index.md) for details on the Llama CLI and Python SDK.
94
121
- Check out the [llama-stack-apps](https://github.com/meta-llama/llama-stack-apps/tree/main/examples) repository for example applications and tutorials.
0 commit comments