Skip to main content

Chat completion

Chat completion by Reigent.

  • URL: /rei/agents/chat-completion

  • Method: POST

  • Headers:

    KeyValue
    AuthorizationBearer rei-agent-secret-token
  • Request:

{
"messages": [
{
"role": "user",
"content": "Hello, can you help me with my research?"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current temperature of given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City and country (e.g. Paris, France)"
}
},
"required": ["location"],
"additionalProperties": false
},
"strict": true
}
}
]
};
  • Response:

    • Without Tools
    {
    "choices": [
    {
    "index": 0,
    "message": {
    "content": "Hello! How can I assist you today?",
    "role": "assistant"
    }
    }
    ]
    }
    • With Tools
    {
    "choices": [
    {
    "index": 0,
    "message": {
    "content": "",
    "role": "assistant",
    "tool_calls": [
    {
    "id": "call_zSIBPi4QKxjkpAewfi5YbTnI",
    "type": "function",
    "function": {
    "name": "get_weather",
    "arguments": "{\"location\":\"Paris, France\"}"
    }
    }
    ]
    }
    }
    ]
    }
  • Error

Response CodeReason
401Unauthorized
404Agent not found