Super-Rag with SDK

Superagent also supports using SuperRag via SDK. Let’s see how to use it.

Ingesting data to Vector Database

You can do this by sending a POST request to the /ingest endpoint. Here’s an example.

Plugging SuperRag into Superagent

To use SuperRag, you need to add it to Superagent as a tool.

1tool = client.tool.create(request={
2 "name": "Financial Reports data",
3 "description": "Useful for answering questions about financial reports",
4 "type": "SUPERRAG",
5 "metadata": {
6 "vector_database": {
7 "type": "pinecone", # make sure this is the same as the type of vector database you have used in SuperRag
8 },
9 "index_name": "financial_reports", # make sure this is the same as the index name you have used in SuperRag
10 }
11})
12
13agent = client.agent.create(request={
14 "name": "Financial Reports Agent",
15 "description": "An assistant that can answer questions about financial reports",
16 "isActive": True,
17 "avatar": "" # Optional avatar url jpg/png
18 "prompt": "Answer questions based on the financial reports",
19 "llmModel": "GPT_4_0613"
20})
21
22# Connect the tool to the agent
23client.agent.add_tool(agent_id=agent.data.id, tool_id=tool.data.id)