MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / generate

Method generate

packages/agent-core/src/agent/index.ts:225–254  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Implementers 1

AcpServerpackages/acp-adapter/src/server.ts

Calls 4

splitGenerateOptionsFunction · 0.90
withAuthFunction · 0.85
resolveAuthMethod · 0.65
runFunction · 0.50

Tested by

no test coverage detected