Back to Mindsdb

Create Threads

docs/minds/rest_api/create_thread.mdx

26.1.01.7 KB
Original Source

This API endpoint creates a Thread to contain Messages using the POST method.

Body

None.

Response

<ResponseField name="id" type="string" required>

Unique identifier for the thread.

</ResponseField> <ResponseField name="created_at" type="integer" required>

Timestamp of when the thread was created.

</ResponseField> <ResponseField name="metadata" type="object">

Optional metadata associated with the thread.

</ResponseField> <ResponseField name="object" type="string" required>

The type of the object returned, which is "thread".

</ResponseField> <ResponseField name="tool_resources" type="object">

Information about any associated tool resources.

</ResponseField>

Authorization

A valid API key must be passed in the Authorization header:

Authorization: Bearer MINDS_API_KEY

Generate your API key here.

Path Parameters

None.

<RequestExample>
shell
curl -X POST "https://mdb.ai/threads" \
  -H "Authorization: Bearer MINDS_API_KEY"
python
from openai import OpenAI
client = OpenAI(
    api_key='MINDS_API_KEY',
    base_url='https://mdb.ai/'
)

thread = client.beta.threads.create()
print(thread)
js
import OpenAI from "openai";

const openai = new OpenAI(
    api_key='MINDS_API_KEY',
    baseURL='https://mdb.ai/'
);

async function main() {
  const emptyThread = await openai.beta.threads.create();
  console.log(emptyThread);
}

main();
</RequestExample> <ResponseExample>
json
{
    "id": "mdb_thread_d79c95547e5f4501a32df6f492ad5be9",
    "created_at": 1718884196,
    "metadata": null,
    "object": "thread",
    "tool_resources": null
}
</ResponseExample>