Skip to content

Commit

Permalink
add groq provider
Browse files Browse the repository at this point in the history
  • Loading branch information
xavimondev committed Aug 2, 2024
1 parent 2ccfe26 commit 74ba342
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# seo-ai

## 0.5.0

### Minor Changes

- add groq provider

## 0.4.0

### Minor Changes
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ npx seo-ai config set OPENAI_API_KEY=<your-key>
npx seo-ai config set MISTRAL_API_KEY=<your-key>
```

### GROQ_API_KEY

- Go to the [Groq Console](https://console.groq.com/keys) and generate your API key.
- Set the key:

```bash
npx seo-ai config set GROQ_API_KEY=<your-key>
```

### Run

```sh
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "seo-ai",
"version": "0.4.0",
"version": "0.5.0",
"description": "Command-line tool to generate SEO metadata and HTML meta tags using AI models",
"type": "module",
"license": "MIT",
Expand Down
6 changes: 6 additions & 0 deletions src/commands/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ export const generate = new Command()
compatibility: 'strict'
})
model = openai('gpt-4o')
} else if (lastProvider === 'groq') {
const groq = createOpenAI({
baseURL: 'https://api.groq.com/openai/v1',
apiKey: apiKey
})
model = groq('llama-3.1-70b-versatile')
} else {
logger.error('Invalid provider')
process.exit(0)
Expand Down
5 changes: 3 additions & 2 deletions src/utils/conf.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import Conf from 'conf'

export type Providers = 'openai' | 'mistral'
export type Providers = 'openai' | 'mistral' | 'groq'

const providers: Record<string, Providers> = {
OPENAI_API_KEY: 'openai',
MISTRAL_API_KEY: 'mistral'
MISTRAL_API_KEY: 'mistral',
GROQ_API_KEY: 'groq'
}

export const getProvider = ({ keyName }: { keyName: string }) => providers[keyName]
Expand Down

0 comments on commit 74ba342

Please sign in to comment.