import { ChatCompletionCreateParams, ChatCompletionChunk, ChatCompletion, CreateEmbeddingResponse, EmbeddingCreateParams } from "openai/resources"; import { OpenAILikeInterface } from "../interfaces/OpenAILike"; import { OpenAIService } from "./openai"; import { ChatCompletionStream } from "../utils/stream"; export class DeepSeekAPIService extends OpenAIService implements OpenAILikeInterface { constructor(apiKey: string) { super({ host: "https://api.deepseek.com/v1", apiKey: `${apiKey}` }) } chatComplete(params: ChatCompletionCreateParams): Promise | ChatCompletion> { const messages:any[] = [] params.messages.forEach(m => { if (typeof m.content === 'string') { messages.push({ role: m.role, content: m.content }) } else { if (m.content && m.content[0].type === 'text') { messages.push({ role: m.role, content: m.content[0].text }) } } }) params.messages = messages return super.chatComplete(params) } embeddings(params: EmbeddingCreateParams): Promise { throw new Error("Method not implemented."); } }