mirror of
https://github.com/langchain-ai/langgraphjs.git
synced 2026-07-24 01:55:52 -04:00
RunsClient.create: support stateless Run creation (#1694)
Co-authored-by: David Duong <david@duong.cz>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@langchain/langgraph-sdk": patch
|
||||
---
|
||||
|
||||
Add support for creating stateless runs
|
||||
@@ -1178,7 +1178,7 @@ export class RunsClient<
|
||||
* @returns The created run.
|
||||
*/
|
||||
async create(
|
||||
threadId: string,
|
||||
threadId: string | null,
|
||||
assistantId: string,
|
||||
payload?: RunsCreatePayload
|
||||
): Promise<Run> {
|
||||
@@ -1210,7 +1210,8 @@ export class RunsClient<
|
||||
: undefined,
|
||||
};
|
||||
|
||||
const [run, response] = await this.fetch<Run>(`/threads/${threadId}/runs`, {
|
||||
const endpoint = threadId === null ? "/runs" : `/threads/${threadId}/runs`;
|
||||
const [run, response] = await this.fetch<Run>(endpoint, {
|
||||
method: "POST",
|
||||
json,
|
||||
signal: payload?.signal,
|
||||
|
||||
Reference in New Issue
Block a user