feat(ai): session-level prompt cache key for openai responses
Closes #9232
This commit is contained in:
7 files changed
+97
No files matched your search
@@ -3151,6 +3151,7 @@ async function send() {
|
||||
confirmedConnectionId: confirmedTargetConnId,
|
||||
confirmedDatabase: confirmedTargetDb,
|
||||
confirmedSchema: confirmedTargetSchema,
|
||||
promptCacheKey: conversationId.value || undefined,
|
||||
},
|
||||
history,
|
||||
(event: AgentEvent) => {
|
||||
|
||||
@@ -132,6 +132,8 @@ export interface AiRequestInput {
|
||||
confirmedConnectionId?: string;
|
||||
confirmedDatabase?: string;
|
||||
confirmedSchema?: string;
|
||||
/** Stable per-conversation key forwarded to the Responses API. */
|
||||
promptCacheKey?: string;
|
||||
}
|
||||
|
||||
export interface AiNamespaceSelection {
|
||||
@@ -194,6 +196,7 @@ export async function runAiAction(input: AiRequestInput, history?: api.AiMessage
|
||||
messages,
|
||||
taskContract,
|
||||
maxTokens,
|
||||
promptCacheKey: input.promptCacheKey,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -209,6 +212,7 @@ export async function runAiStream(input: AiRequestInput, history: api.AiMessage[
|
||||
messages,
|
||||
taskContract,
|
||||
maxTokens,
|
||||
promptCacheKey: input.promptCacheKey,
|
||||
},
|
||||
(chunk) => {
|
||||
if (!chunk.done) {
|
||||
@@ -232,6 +236,7 @@ export async function runAgentStream(input: AiRequestInput, history: api.AiMessa
|
||||
messages,
|
||||
taskContract,
|
||||
maxTokens,
|
||||
promptCacheKey: input.promptCacheKey,
|
||||
},
|
||||
input.context.connectionId,
|
||||
input.context.database,
|
||||
|
||||
@@ -498,6 +498,8 @@ export interface AiCompletionRequest {
|
||||
messages: AiMessage[];
|
||||
taskContract?: AiTaskContract;
|
||||
maxTokens?: number;
|
||||
/** Stable per-conversation key used by the Responses API prompt cache. */
|
||||
promptCacheKey?: string;
|
||||
}
|
||||
|
||||
export interface AiModelInfo {
|
||||
|
||||
Reference in new issue
Block a user