(apiKey?: string)
| 51 | }); |
| 52 | console.log(result); |
| 53 | `; |
| 54 | |
| 55 | export const pythonExample = (apiKey?: string) => /* python */ ` |
| 56 | from agentset import Agentset |
| 57 | from openai import OpenAI |
| 58 | |
| 59 | client = Agentset( |
| 60 | namespace_id="{{namespace}}", |
| 61 | token="${apiKey ?? "YOUR_API_KEY"}",${pythonSdkApiUrlOption} |
| 62 | ) |
| 63 | |
| 64 | openai = OpenAI() |
| 65 | |
| 66 | query = "What are the key findings?" |
| 67 | |
| 68 | # Search for relevant context |
| 69 | results = client.search.execute(query=query) |
| 70 | context = "\\n\\n".join([r.text for r in results.data]) |
| 71 | |
| 72 | # Generate a response |
| 73 | response = openai.responses.create( |
| 74 | model="gpt-4.1", |
| 75 | input=[ |
| 76 | { |
| 77 | "role": "system", |
| 78 | "content": f"Answer questions based on the following context:\n\n{context}", |
| 79 | }, |
| 80 | { |
| 81 | "role": "user", |
| 82 | "content": query, |
| 83 | }, |
| 84 | ], |
| 85 | ) |
| 86 | |
| 87 | print(response) |
| 88 | `; |
nothing calls this directly
no outgoing calls
no test coverage detected