MCPcopy Create free account
hub / github.com/Effect-TS/effect / prepareResponseFormat

Function prepareResponseFormat

packages/ai/openai/src/OpenAiLanguageModel.ts:1439–1455  ·  view source on GitHub ↗
(
  options: LanguageModel.ProviderOptions,
  config: Config.Service
)

Source from the content-addressed store, hash-verified

1437}
1438
1439const prepareResponseFormat = (
1440 options: LanguageModel.ProviderOptions,
1441 config: Config.Service
1442): typeof Generated.TextResponseFormatConfiguration.Encoded => {
1443 if (options.responseFormat.type === "json") {
1444 const name = options.responseFormat.objectName
1445 const schema = options.responseFormat.schema
1446 return {
1447 type: "json_schema",
1448 name,
1449 description: Tool.getDescriptionFromSchemaAst(schema.ast) ?? "Response with a JSON object",
1450 schema: Tool.getJsonSchemaFromSchemaAst(schema.ast) as any,
1451 strict: config.strict ?? true
1452 }
1453 }
1454 return { type: "text" }
1455}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected