Skip to content

Commit 98164c8

Browse files
committed
client-openai-vector_stores-responses.py
1 parent ac08232 commit 98164c8

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/python3
2+
3+
# ./llama-stack/docs/docs/getting_started/demo_script.py
4+
5+
import io, requests
6+
from openai import OpenAI
7+
8+
c = OpenAI(base_url="http://localhost:8321/v1/", api_key="none")
9+
10+
vs = c.vector_stores.create()
11+
buf = io.BytesIO(str("abc is green").encode('utf-8'))
12+
13+
fid = c.files.create(file=("aa.txt", buf), purpose="assistants").id
14+
c.vector_stores.files.create(vs.id, file_id=fid)
15+
16+
resp = c.responses.create(
17+
model="vertexai/google/gemini-2.5-flash",
18+
input="What is the color of abc?",
19+
tools=[{"type": "file_search", "vector_store_ids": [vs.id]}],
20+
# include=["file_search_call.results"],
21+
)
22+
23+
print(resp.output[-1].content[-1].text)

0 commit comments

Comments
 (0)