Generating response using Quack AI

Authentication

Authenticating to the API is done using an API key that is passed in an Authentication header. All requests to an API endpoint, must contain the following header:

Authorization: Bearer <API_KEY>

To get your API_KEY reach out to your account manager @Quack AI.

POST /conversation

Start a conversation. Optionally, send context data to initialize the session. A conversation_id will be returned in the response header.

Request:

// Headers
"X-Quack-Conversation-ID": "abc123" // if you don't have send without -> it will create a new one
// Payload example
{
  "context": {
    "user_id": "1234",
    "product_line": "Product 1"
  },
  "messages":[
  // you can put here previous messages
    {
      "content":"what integrations you support? ",
      "role":"user" // roles will always be user or assistant
    },
  ]
}
// ץא
// conversation.types.ts

type Message {
    content:string;
    role: "user" | "assistant"
}

interface ConversationRequestParams {
    context?:any,
    messages:Message[]
}

For not streamed response - add query param⇒ `stream=false`

Response ( will be streamed ):

200 Created
X-Quack-Conversation-ID: "abc123"
Content-Type: "text/plain; charset=utf-8" // It will be streamed back

In case of answer:

```
0:"Hi"
0:","
0:" This"
0:" Will"
0:" be"
0:" the response"
0:".\n\n"
0:"Quack"
0:" will"
0:" stream"
0:" it"
```

In case of escalating to agent

// the response will include toolCallId with result of "talk_to_an_agent"
```
a:{"toolCallId":"call_P9Xonb8qLaqwAursPMOHzibE","result":"talk_to_an_agent"}
```

In case of skipping ( out of scope for Quack / Quack can't answer it ):

// the response will include toolCallId with result of "skip_it"
```
a:{"toolCallId":"call_orLGhq3LG9tKkCOErl3DJJoW","result":"skip_it"}
```

Last updated