effect
effect copied to clipboard
@effect/ai-openai add options to enable OpenAI specific built-in tools when using OpenAiLanguageModel
What is the problem this feature would solve?
I would like to be able to specify more options when using OpenAiLanguageModel, like adding built-in tools.
Here's an example function:
const findSomethingOnTheWeb = (input: string) =>
Effect.gen(function* () {
const languageModel = yield* AiLanguageModel.AiLanguageModel;
return yield* languageModel
.generateObject({
prompt: input,
system: String.stripMargin(
`some instructions`,
),
schema: Schema.Struct({
test: Schema.Union(Schema.String, Schema.Null),
}),
})
.pipe(
OpenAiLanguageModel.withConfigOverride({
temperature: 0.1,
// tools ? 'web_search_preview'
}),
);
});
What is the feature you are proposing to solve the problem?
Update @effect/ai-openai to allow more config options and be closer to OpenAI API.
What alternatives have you considered?
The current alternative I have is to use the lower level OpenAiClient effect API with code like
const response = yield* openai.client.createResponse({
model: 'gpt-4.1',
tools: [{ type: 'web_search_preview' }],
input: `find something`,
});