42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import type { AssistantAddressLaneLike } from "./assistantAddressLaneRuntimeAdapter";
|
|
import type { AssistantAddressCarryoverLike } from "./assistantAddressOrchestrationRuntimeAdapter";
|
|
import {
|
|
buildAssistantAddressLaneAttemptQueryOptions,
|
|
resolveAssistantAddressLaneAttemptFollowupContext
|
|
} from "./assistantAddressLaneAttemptQueryOptionsBuilder";
|
|
|
|
export interface RunAssistantAddressLaneAttemptRuntimeInput {
|
|
messageUsed: string;
|
|
carryMeta: AssistantAddressCarryoverLike | null;
|
|
analysisDateHint: string | null;
|
|
activeOrganization: string | null;
|
|
mergeFollowupContextWithOrganizationScope: (
|
|
followupContext: Record<string, unknown> | null,
|
|
organization: string | null
|
|
) => Record<string, unknown> | null;
|
|
runAddressQueryTryHandle: (
|
|
messageUsed: string,
|
|
options: {
|
|
followupContext?: Record<string, unknown>;
|
|
analysisDateHint?: string | null;
|
|
}
|
|
) => Promise<AssistantAddressLaneLike | null>;
|
|
}
|
|
|
|
export async function runAssistantAddressLaneAttemptRuntime(
|
|
input: RunAssistantAddressLaneAttemptRuntimeInput
|
|
): Promise<AssistantAddressLaneLike | null> {
|
|
const followupContext = resolveAssistantAddressLaneAttemptFollowupContext(input.carryMeta);
|
|
const scopedFollowupContext = input.mergeFollowupContextWithOrganizationScope(
|
|
followupContext,
|
|
input.activeOrganization
|
|
);
|
|
return input.runAddressQueryTryHandle(
|
|
input.messageUsed,
|
|
buildAssistantAddressLaneAttemptQueryOptions({
|
|
analysisDateHint: input.analysisDateHint,
|
|
scopedFollowupContext
|
|
})
|
|
);
|
|
}
|