MCPcopy
hub / github.com/continuedev/continue / getLlmApi

Function getLlmApi

extensions/cli/src/config.ts:60–88  ·  view source on GitHub ↗
(
  assistant: AssistantUnrolled,
  authConfig: AuthConfig,
)

Source from the content-addressed store, hash-verified

58}
59
60export function getLlmApi(
61 assistant: AssistantUnrolled,
62 authConfig: AuthConfig,
63): [BaseLlmApi, ModelConfig] {
64 if (!assistant.models || assistant.models.length === 0) {
65 throw new Error("No models found in the configured assistant");
66 }
67
68 const model = assistant.models?.find(
69 (model) =>
70 model?.roles?.includes("chat") || (model && model.roles === undefined),
71 );
72
73 if (!model) {
74 throw new Error(
75 "No models with the chat role found in the configured assistant",
76 );
77 }
78
79 const llmApi = createLlmApi(model, authConfig);
80
81 if (!llmApi) {
82 throw new Error(
83 "Failed to initialize LLM. Please check your configuration.",
84 );
85 }
86
87 return [llmApi, model];
88}
89
90export function getApiClient(
91 accessToken: string | undefined | null,

Callers 2

config.test.tsFile · 0.70
doInitializeMethod · 0.50

Calls 1

createLlmApiFunction · 0.85

Tested by

no test coverage detected