Skip to content

Commit

Permalink
maint: Remove groq sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
RPate97 committed Jul 14, 2024
1 parent d01773d commit 3acef3c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 36 deletions.
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
"name": "token.js",
"version": "0.0.2",
"description": "Integrate 9 LLM providers with a single Typescript SDK using OpenAIs format.",
"main": "dist/index",
"types": "dist/index",
"main": "dist/index.cjs",
"module": "dist/index.js",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"files": [
"dist/*"
],
Expand Down Expand Up @@ -31,7 +37,6 @@
"axios": "^1.7.2",
"chalk": "^4.1.2",
"cohere-ai": "^7.10.6",
"groq-sdk": "^0.5.0",
"mime-types": "^2.1.35",
"nanoid": "^5.0.7",
"openai": "^4.52.2"
Expand Down
18 changes: 0 additions & 18 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 4 additions & 15 deletions src/handlers/groq.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Groq from 'groq-sdk'
import OpenAI from 'openai'

import { GroqModel, ProviderCompletionParams } from '../chat'
import { CompletionResponse, StreamCompletionResponse } from '../userTypes'
Expand Down Expand Up @@ -32,10 +32,9 @@ export class GroqHandler extends BaseHandler<GroqModel> {
this.validateInputs(body)

const apiKey = this.opts.apiKey ?? process.env.GROQ_API_KEY
const baseURL = this.opts.baseURL
const client = new Groq({
const client = new OpenAI({
apiKey,
baseURL,
baseURL: 'https://api.groq.com/openai/v1',
})

if (apiKey === undefined) {
Expand All @@ -44,16 +43,6 @@ export class GroqHandler extends BaseHandler<GroqModel> {
)
}

return client.chat.completions.create({
stream: body.stream,
messages: body.messages as Groq.Chat.ChatCompletionMessageParam[],
model: body.model,
temperature: body.temperature,
max_tokens: body.max_tokens,
top_p: body.top_p,
stop: body.stop,
n: body.n,
response_format: body.response_format,
})
return client.chat.completions.create(body)
}
}

0 comments on commit 3acef3c

Please sign in to comment.