()
| 223 | } |
| 224 | |
| 225 | get generate(): typeof generate { |
| 226 | return async (provider, systemPrompt, tools, history, callbacks, options) => { |
| 227 | const { requestLogFields, generateOptions } = splitGenerateOptions(options); |
| 228 | const modelAlias = this.config.modelAlias; |
| 229 | const run = (requestOptions: Parameters<typeof generate>[5]) => { |
| 230 | this.llmRequestLogger.logRequest({ |
| 231 | provider, |
| 232 | modelAlias, |
| 233 | systemPrompt, |
| 234 | tools, |
| 235 | messages: history, |
| 236 | fields: requestLogFields, |
| 237 | }); |
| 238 | return this.rawGenerate(provider, systemPrompt, tools, history, callbacks, requestOptions); |
| 239 | }; |
| 240 | if (generateOptions?.auth !== undefined) { |
| 241 | return run(generateOptions); |
| 242 | } |
| 243 | const withAuth = |
| 244 | modelAlias === undefined |
| 245 | ? undefined |
| 246 | : this.modelProvider?.resolveAuth?.(modelAlias, { log: this.log }); |
| 247 | if (withAuth === undefined) { |
| 248 | return run(generateOptions); |
| 249 | } |
| 250 | return withAuth((auth) => { |
| 251 | return run({ ...generateOptions, auth }); |
| 252 | }); |
| 253 | }; |
| 254 | } |
| 255 | |
| 256 | get llm(): KosongLLM { |
| 257 | // All provider-level request config (thinking, sampling params, thinking.keep) |
nothing calls this directly
no test coverage detected