diff --git a/src/providers/openai-compatible-provider.ts b/src/providers/openai-compatible-provider.ts index ed38f81..c8a065a 100644 --- a/src/providers/openai-compatible-provider.ts +++ b/src/providers/openai-compatible-provider.ts @@ -16,6 +16,17 @@ export interface OpenAICompatibleProviderOptions { headers?: Record | undefined; } +type JsonObject = Record; + +function isJsonObject(value: unknown): value is JsonObject { + return typeof value === "object" && value !== null && !Array.isArray(value); +} + +function getBodyExcerpt(body: string): string { + const excerpt = body.replace(/\s+/g, " ").trim().slice(0, 200); + return excerpt.length > 0 ? excerpt : ""; +} + export class OpenAICompatibleModelProvider implements ModelProvider { public readonly name = "openai-compatible"; private readonly apiKey: string;