mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-01 11:26:23 +02:00
use strict compatibility in createOpenAI
When using createOpenAI() from @ai-sdk/openai w/o provider override, token usage info is sent as 0 or null. Enforcing compatibilty fixes this.
This commit is contained in:
parent
a0bb7e6404
commit
bf29af3083
2 changed files with 4 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// External dependencies
|
||||
import { Agent, AgentInputItem, run, Tool } from "@openai/agents";
|
||||
import { Agent, AgentInputItem, run, RunRawModelStreamEvent, Tool } from "@openai/agents";
|
||||
import { RECOMMENDED_PROMPT_PREFIX } from "@openai/agents-core/extensions";
|
||||
import { aisdk } from "@openai/agents-extensions";
|
||||
import { createOpenAI } from "@ai-sdk/openai";
|
||||
|
|
@ -78,6 +78,7 @@ interface AgentState {
|
|||
const openai = createOpenAI({
|
||||
apiKey: PROVIDER_API_KEY,
|
||||
baseURL: PROVIDER_BASE_URL,
|
||||
compatibility: "strict",
|
||||
});
|
||||
|
||||
const ZOutMessage = z.union([
|
||||
|
|
@ -734,7 +735,7 @@ function maybeInjectGiveUpControlInstructions(
|
|||
|
||||
// Handle raw model stream events
|
||||
async function* handleRawModelStreamEvent(
|
||||
event: any,
|
||||
event: RunRawModelStreamEvent,
|
||||
agentConfig: Record<string, z.infer<typeof WorkflowAgent>>,
|
||||
agentName: string,
|
||||
turnMsgs: z.infer<typeof Message>[],
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ const SYSTEM_PROMPT = [
|
|||
const openai = createOpenAI({
|
||||
apiKey: PROVIDER_API_KEY,
|
||||
baseURL: PROVIDER_BASE_URL,
|
||||
compatibility: "strict",
|
||||
});
|
||||
|
||||
const ZTextEvent = z.object({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue