feat: simplify types

This commit is contained in:
Patrick Erichsen 2025-05-01 11:04:03 -07:00
parent 2a51fc1cb2
commit b18fd4aee0
2 changed files with 6 additions and 25 deletions

View file

@ -6,30 +6,17 @@ import { Assistant } from "./Assistant";
import { createOpenAIClient } from "./createOpenAIClient";
export interface ContinueClientOptions {
apiKey?: string;
assistant: string;
apiKey: string;
organizationId?: string;
assistant?: string;
baseURL?: string;
}
/**
* Result from Continue.from() containing configured clients
*/
export type ContinueResult = {
/**
* The Continue API client
*/
api: DefaultApi;
} & (
| {
client: OpenAI;
assistant: Assistant;
}
| {
client?: undefined;
assistant?: undefined;
}
);
client: OpenAI;
assistant: Assistant;
};
export class Continue {
/**
@ -50,12 +37,6 @@ export class Continue {
}),
);
if (!options.assistant) {
return {
api,
};
}
const { ownerSlug, packageSlug } = decodePackageSlug(options.assistant);
if (!ownerSlug || !packageSlug) {
throw new Error(

View file

@ -26,7 +26,7 @@ test("should make a real API call to the Continue service", async () => {
baseURL: "http://localhost:3001",
});
const response = await client?.chat.completions.create({
const response = await client.chat.completions.create({
model: assistant.getModel(modelName),
messages: [
{ role: "system", content: assistant.systemMessage },