(
options:
& Options
& GenerateObjectOptions<
Tools,
StructuredOutputSchema,
false | Extract<Options["allowEmpty" & keyof Options], boolean>
>
)
| 981 | ) as any |
| 982 | |
| 983 | const generateObject = < |
| 984 | ObjectEncoded extends Record<string, any>, |
| 985 | StructuredOutputSchema extends Schema.Encoder<ObjectEncoded, unknown>, |
| 986 | Options extends NoExcessProperties< |
| 987 | GenerateObjectOptions<any, StructuredOutputSchema, boolean>, |
| 988 | Options |
| 989 | >, |
| 990 | Tools extends Record<string, Tool.Any> = {} |
| 991 | >( |
| 992 | options: |
| 993 | & Options |
| 994 | & GenerateObjectOptions< |
| 995 | Tools, |
| 996 | StructuredOutputSchema, |
| 997 | false | Extract<Options["allowEmpty" & keyof Options], boolean> |
| 998 | > |
| 999 | ): Effect.Effect< |
| 1000 | GenerateObjectResponse< |
| 1001 | Tools, |
| 1002 | ExtractObjectValue<Options, StructuredOutputSchema["Type"]>, |
| 1003 | ExtractToolParametersMode<Options> |
| 1004 | >, |
| 1005 | ExtractError<Options>, |
| 1006 | ExtractServices<Options> | StructuredOutputSchema["DecodingServices"] |
| 1007 | > => { |
| 1008 | const objectName = getObjectName(options.objectName, options.schema) |
| 1009 | return Effect.useSpan( |
| 1010 | "LanguageModel.generateObject", |
| 1011 | { |
| 1012 | kind: "client", |
| 1013 | attributes: { "effect.ai.object_name": objectName } |
| 1014 | }, |
| 1015 | Effect.fnUntraced( |
| 1016 | function*(span) { |
| 1017 | const spanTransformer = yield* getSpanTransformer |
| 1018 | |
| 1019 | const providerOptions: Mutable<ProviderOptions> = { |
| 1020 | prompt: Prompt.make(options.prompt), |
| 1021 | tools: [], |
| 1022 | toolChoice: "none", |
| 1023 | responseFormat: { |
| 1024 | type: "json", |
| 1025 | objectName, |
| 1026 | schema: options.schema |
| 1027 | }, |
| 1028 | span, |
| 1029 | previousResponseId: undefined, |
| 1030 | incrementalPrompt: undefined |
| 1031 | } |
| 1032 | |
| 1033 | const content = yield* generateContent(options, providerOptions) |
| 1034 | |
| 1035 | applySpanTransformer( |
| 1036 | spanTransformer, |
| 1037 | content as any, |
| 1038 | providerOptions |
| 1039 | ) |
| 1040 |
nothing calls this directly
no test coverage detected