MCPcopy Index your code
hub / github.com/Effect-TS/effect / prepareResponseFormat

Function prepareResponseFormat

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected