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(options)

Update an existing thread's metadata.

Function Signature

langbase.threads.update(options);

// with types
langbase.threads.update(options: ThreadsUpdate);

options

  • Name
    options
    Type
    ThreadsUpdate
    Description

    ThreadsUpdate Object

    export interface ThreadsUpdate {
    	threadId: string;
    	metadata: Record<string, string>;
    }
    

Usage example

Install the SDK

npm i langbase

Environment variables

.env file

LANGBASE_API_KEY="<USER/ORG-API-KEY>"

langbase.threads.update() example

Update Example

const updated = await langbase.threads.update({
	threadId: "thread_123",
	metadata: {
		status: "resolved"
	}
});

Response

The response of the threads.update() function is a promise that resolves to a ThreadsBaseResponse object.

ThreadsBaseResponse

export interface ThreadsBaseResponse {
	id: string;
	object: 'thread';
	created_at: number;
	metadata: Record<string, string>;
}

Response Example

{
	"id": "thread_123",
	"object": "thread",
	"created_at": 1709544000,
	"metadata": {
		"status": "resolved"
	}
}