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

Method from

packages/continue-sdk/typescript/src/Continue.ts:94–146  ·  view source on GitHub ↗

* Internal implementation

(
    options: ContinueClientOptions,
  )

Source from the content-addressed store, hash-verified

92 * Internal implementation
93 */
94 static async from(
95 options: ContinueClientOptions,
96 ): Promise<ContinueClientBase | ContinueClient> {
97 const baseURL = options.baseURL || "https://api.continue.dev/";
98
99 const continueClient = new DefaultApi(
100 new Configuration({
101 basePath: baseURL,
102 accessToken: options.apiKey
103 ? async () => options.apiKey as string
104 : undefined,
105 }),
106 );
107
108 if (!options.assistant) {
109 return { api: continueClient };
110 }
111
112 const { ownerSlug, packageSlug } = decodePackageSlug(options.assistant);
113 if (!ownerSlug || !packageSlug) {
114 throw new Error(
115 `Invalid assistant identifier: ${options.assistant}. Expected format: owner-slug/package-slug`,
116 );
117 }
118
119 const assistants = await continueClient.listAssistants({
120 organizationId: options.organizationId,
121 alwaysUseProxy: "true",
122 });
123
124 const assistantRes = assistants.find(
125 (a) => a.ownerSlug === ownerSlug && a.packageSlug === packageSlug,
126 );
127
128 if (!assistantRes) {
129 throw new Error(`Assistant ${options.assistant} not found`);
130 }
131
132 const assistant = new Assistant(assistantRes.configResult.config);
133
134 const client = createOpenAIClient({
135 models: assistant.config.models,
136 organizationId: options.organizationId || null,
137 apiKey: options.apiKey,
138 baseURL: baseURL,
139 });
140
141 return {
142 api: continueClient,
143 client,
144 assistant,
145 };
146 }
147}

Callers 15

findAllMethod · 0.80
getAllTodosMethod · 0.80
getAllProductsMethod · 0.80
getCertificateContentFunction · 0.80
fixedCaMethod · 0.80
onDataFunction · 0.80
certs.test.tsFile · 0.80
streamResponseFunction · 0.80

Calls 3

listAssistantsMethod · 0.95
decodePackageSlugFunction · 0.90
createOpenAIClientFunction · 0.85

Tested by 1

createMockHistoryFunction · 0.64