adding support for generic AI provider (OpenAI compatible)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { openai } from '../agent.js';
|
||||
import { openai, defaultModel, serviceOptions, supportsWebSearch } from '../agent.js';
|
||||
import type { InterpreterOutput, RetrievalOutput, MediaType } from '../types/agents.js';
|
||||
import { z } from 'zod';
|
||||
import { zodTextFormat } from 'openai/helpers/zod';
|
||||
@@ -19,11 +19,12 @@ export async function runRetrieval(
|
||||
const mediaLabel = mediaType === 'movie' ? 'movie' : 'TV show';
|
||||
const mediaLabelPlural = mediaType === 'movie' ? 'movies' : 'TV shows';
|
||||
|
||||
const canSearch = useWebSearch && supportsWebSearch;
|
||||
const response = await openai.responses.parse({
|
||||
model: 'gpt-5.4',
|
||||
model: defaultModel,
|
||||
temperature: 0.9,
|
||||
service_tier: 'flex',
|
||||
...(useWebSearch ? { tools: [{ type: 'web_search' as const }] } : {}),
|
||||
...serviceOptions,
|
||||
...(canSearch ? { tools: [{ type: 'web_search' as const }] } : {}),
|
||||
text: { format: zodTextFormat(RetrievalSchema, "candidates") },
|
||||
instructions: `You are a ${mediaLabel} candidate generator. Your goal is to brainstorm a LARGE, DIVERSE pool of ${brainstormCount} ${mediaLabel} candidates that match the user's structured preferences.${useWebSearch ? '\n\nUse web search to find recent and accurate titles, including newer releases.' : ''}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user