mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-29 11:24:19 +00:00
fix: Fix docs lint issues (#1993)
# What does this PR do?
This was not caught as part of the CI build:
dd62a2388c
.
[This PR](https://github.com/meta-llama/llama-stack/pull/1354) was too
old and didn't include the additional CI builds yet.
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
This commit is contained in:
parent
dd62a2388c
commit
4c6b7005fa
1 changed files with 15 additions and 11 deletions
|
@ -232,8 +232,10 @@ from llama_stack_client import LlamaStackClient
|
||||||
|
|
||||||
client = LlamaStackClient(
|
client = LlamaStackClient(
|
||||||
base_url=f"http://localhost:8321",
|
base_url=f"http://localhost:8321",
|
||||||
provider_data = {"tavily_search_api_key": "your_TAVILY_SEARCH_API_KEY"} # Set this from the client side. No need to provide it if it has already been configured on the Llama Stack server.
|
provider_data={
|
||||||
)
|
"tavily_search_api_key": "your_TAVILY_SEARCH_API_KEY"
|
||||||
|
}, # Set this from the client side. No need to provide it if it has already been configured on the Llama Stack server.
|
||||||
|
)
|
||||||
|
|
||||||
agent = Agent(
|
agent = Agent(
|
||||||
client,
|
client,
|
||||||
|
@ -242,12 +244,14 @@ agent = Agent(
|
||||||
"You are a web search assistant, must use websearch tool to look up the most current and precise information available. "
|
"You are a web search assistant, must use websearch tool to look up the most current and precise information available. "
|
||||||
),
|
),
|
||||||
tools=["builtin::websearch"],
|
tools=["builtin::websearch"],
|
||||||
)
|
)
|
||||||
|
|
||||||
session_id = agent.create_session("websearch-session")
|
session_id = agent.create_session("websearch-session")
|
||||||
|
|
||||||
response = agent.create_turn(
|
response = agent.create_turn(
|
||||||
messages=[{"role": "user", "content": "How did the USA perform in the last Olympics?"}],
|
messages=[
|
||||||
|
{"role": "user", "content": "How did the USA perform in the last Olympics?"}
|
||||||
|
],
|
||||||
session_id=session_id,
|
session_id=session_id,
|
||||||
)
|
)
|
||||||
for log in EventLogger().log(response):
|
for log in EventLogger().log(response):
|
||||||
|
@ -264,15 +268,15 @@ for log in EventLogger().log(response):
|
||||||
```python
|
```python
|
||||||
client = LlamaStackClient(
|
client = LlamaStackClient(
|
||||||
base_url="http://localhost:8321",
|
base_url="http://localhost:8321",
|
||||||
provider_data={"wolfram_alpha_api_key": wolfram_api_key}
|
provider_data={"wolfram_alpha_api_key": wolfram_api_key},
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
3. Configure the tools in the Agent by setting `tools=["builtin::wolfram_alpha"]`.
|
3. Configure the tools in the Agent by setting `tools=["builtin::wolfram_alpha"]`.
|
||||||
4. Example user query:
|
4. Example user query:
|
||||||
```python
|
```python
|
||||||
response = agent.create_turn(
|
response = agent.create_turn(
|
||||||
messages=[{"role": "user", "content": "Solve x^2 + 2x + 1 = 0 using WolframAlpha"}],
|
messages=[{"role": "user", "content": "Solve x^2 + 2x + 1 = 0 using WolframAlpha"}],
|
||||||
session_id=session_id,
|
session_id=session_id,
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
```
|
```
|
Loading…
Add table
Add a link
Reference in a new issue