Search documentation
karat

+

K

User Documentation ↗

Rag Context Session

PUT/api/v2/aipAgents/agents/{agentRid}/sessions/{sessionRid}/ragContext
Warning

This endpoint is in preview and may be modified or removed at any time. To use this endpoint, add preview=true to the request query parameters.

Retrieve relevant context for a user message from the data sources configured for the session. This allows clients to pre-retrieve context for a user message before sending it to the Agent with the contextsOverride option when continuing a session, to allow any pre-processing of the context before sending it to the Agent.

Third-party applications using this endpoint via OAuth2 must request the following operation scope: api:aip-agents-write.

Path parameters

agentRid
string

An RID identifying an AIP Agent created in AIP Agent Studio.

sessionRid
string

The Resource Identifier (RID) of the conversation session.

Query parameters

preview
boolean
optional

Enables the use of preview functionality.

Request body

RagContextSessionRequest
object
Hide child attributes

Hide child attributes

userInput
object

The user message to retrieve relevant context for from the configured Agent data sources.

Show child attributes

Show child attributes

parameterInputs
map<ParameterId, ParameterValue>
optional

Any parameter values to use for the context retrieval.

Show child attributes

Show child attributes

Response body

AgentSessionRagContextResponse
object

Context retrieved from an Agent's configured context data sources which was relevant to the supplied user message.

Hide child attributes

Hide child attributes

objectContexts
list<ObjectContext>
optional
Show child attributes

Show child attributes

Examples

Request

Copied!
1 2 3 4 5 curl -X PUT \ -H "Content-type: application/json" \ -H "Authorization: Bearer $TOKEN" \ "https://$HOSTNAME/api/v2/aipAgents/agents/ri.aip-agents..agent.732cd5b4-7ca7-4219-aabb-6e976faf63b1/sessions/ri.aip-agents..session.292db3b2-b653-4de6-971c-7e97a7b881d6/ragContext?preview=true" \ -d '{"userInput":{"text":"What is the status of my order?"}}'

Response

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 { "objectContexts": [ { "objectRids": [ "ri.phonograph2-objects.main.object.48668bf6-8878-48d2-b8f8-f0017593feb5" ], "propertyTypeRids": [ "ri.ontology.main.property.7899aeb4-a389-4f2e-a0fd-e7193a4f6cb1" ] } ] }