Skip to content

Commit 99246ff

Browse files
committed
allow promptMessageId on saveMessage
1 parent 21dbd1a commit 99246ff

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- Adds a /test entrypoint to make adding tests with the agent easier.
1414
- Simplifies the types for generating object & text to more closely match the AI
1515
SDK.
16+
- Allows passing a `promptMessageId` to `saveMessage` to match `saveMessages`.
1617

1718
## 0.2.10
1819

src/client/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ export class Agent<
798798
: [args.message],
799799
metadata: args.metadata ? [args.metadata] : undefined,
800800
skipEmbeddings: args.skipEmbeddings,
801+
promptMessageId: args.promptMessageId,
801802
pendingMessageId: args.pendingMessageId,
802803
});
803804
const message = messages.at(-1)!;

src/client/messages.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ export async function saveMessages(
160160
export type SaveMessageArgs = {
161161
threadId: string;
162162
userId?: string | null;
163+
/**
164+
* The message that these messages are in response to. They will be
165+
* the same "order" as this message, at increasing stepOrder(s).
166+
*/
167+
promptMessageId?: string;
163168
/**
164169
* Metadata to save with the messages. Each element corresponds to the
165170
* message at the same index.
@@ -218,6 +223,7 @@ export async function saveMessage(
218223
threadId: args.threadId,
219224
userId: args.userId ?? undefined,
220225
agentName: args.agentName,
226+
promptMessageId: args.promptMessageId,
221227
pendingMessageId: args.pendingMessageId,
222228
messages:
223229
args.prompt !== undefined

0 commit comments

Comments
 (0)