Skip to content

Commit

Permalink
add deepseek support
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcrt committed Feb 12, 2025
1 parent c1e0a4b commit 77f087d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
5 changes: 3 additions & 2 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
"dependencies": {
"@anthropic-ai/sdk": "^0.36.3",
"@google/generative-ai": "^0.21.0",
"abso-ai": "^0.0.4",
"lunary": "^0.8.8",
"openai": "^4.83.0",
},
"devDependencies": {
"@types/bun": "latest",
"tsup": "^8.3.6",
},
"peerDependencies": {
"typescript": "^5.7.3",
},
},
Expand Down Expand Up @@ -137,6 +136,8 @@

"abort-controller": ["abort-controller@3.0.0", "", { "dependencies": { "event-target-shim": "^5.0.0" } }, "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg=="],

"abso-ai": ["abso-ai@0.0.4", "", { "dependencies": { "@anthropic-ai/sdk": "^0.36.3", "@google/generative-ai": "^0.21.0", "lunary": "^0.8.8", "openai": "^4.83.0" } }, "sha512-ErErYABRELU2mZ/9gSgnVkYfwarSEMFjPGS0QxHU3Oj5FayiHY6iO06Az+/Veh+nmiiuOAF3Kdbvi/OiICMbwg=="],

"acorn": ["acorn@8.14.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA=="],

"agentkeepalive": ["agentkeepalive@4.6.0", "", { "dependencies": { "humanize-ms": "^1.2.1" } }, "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ=="],
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "abso-ai",
"version": "0.0.3",
"version": "0.0.4",
"module": "src/index.ts",
"description": "Abso AI SDK. Call LLMs using a single API.",
"type": "module",
Expand Down Expand Up @@ -42,6 +42,7 @@
"dependencies": {
"@anthropic-ai/sdk": "^0.36.3",
"@google/generative-ai": "^0.21.0",
"abso-ai": "^0.0.4",
"lunary": "^0.8.8",
"openai": "^4.83.0"
}
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { XaiProvider } from "./providers/xai"
import { OllamaProvider } from "./providers/ollama"
import { VoyageProvider } from "./providers/voyage"
import { GeminiProvider } from "./providers/gemini"
import { DeepSeekProvider } from "./providers/deepseek"

// Provider configuration map
const providerConfigs = [
Expand All @@ -23,6 +24,7 @@ const providerConfigs = [
{ key: "XAI_API_KEY", Provider: XaiProvider },
{ key: "VOYAGE_API_KEY", Provider: VoyageProvider },
{ key: "GEMINI_API_KEY", Provider: GeminiProvider },
{ key: "DEEPSEEK_API_KEY", Provider: DeepSeekProvider },
] as const

// Initialize providers based on available API keys
Expand Down
21 changes: 21 additions & 0 deletions src/providers/deepseek.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { OpenAIProvider } from "./openai"
import type { IProvider } from "../types"

interface DeepSeekProviderOptions {
apiKey?: string
}

export class DeepSeekProvider extends OpenAIProvider implements IProvider {
public name = "deepseek"

constructor(options: DeepSeekProviderOptions) {
super({
apiKey: options.apiKey,
baseURL: "https://api.deepseek.com",
})
}

matchesModel(model: string): boolean {
return model.includes("deepseek")
}
}

0 comments on commit 77f087d

Please sign in to comment.