Update Thread langbase.threads.update()
You can use the threads.update()
function to modify an existing thread's metadata. This helps you manage and organize your conversation threads effectively.
Generate a User/Org API key
You will need to generate an API key to authenticate your requests. For more information, visit the User/Org API key documentation.
API reference
langbase.threads.update()
Function Signature
langbase.threads.update(options);
// with types
langbase.threads.update(options: ThreadsUpdate);
options
- Name
options
- Type
- ThreadsUpdate
- Description
ThreadsUpdate Object
threadId: string; metadata: Record<string, string>;
- Name
threadId
- Type
- string
- Required
- Required
- Description
The ID of the thread to update.
- Name
metadata
- Type
- Record<string, string>
- Required
- Required
- Description
The new metadata for the thread.
Usage example
Install the SDK
npm i langbase
Environment variables
Environment variables
LANGBASE_API_KEY="<USER/ORG-API-KEY>"
Update a thread
Update a thread on Langbase
const updated = await langbase.threads.update({
threadId: "thread_123",
metadata: {
status: "resolved"
}
});
Response
- Name
ThreadsBaseResponse
- Type
- object
- Description
The response of the
threads.update()
function is a promise that resolves to aThreadsBaseResponse
object.ThreadsBaseResponse
id: string; object: 'thread'; created_at: number; metadata: Record<string, string>;
ThreadsBaseResponse type of langbase.threads.update()
{
"id": "thread_123",
"object": "thread",
"created_at": 1709544000,
"metadata": {
"status": "resolved"
}
}