Skip to content

Commit

Permalink
#Modified for Groq
Browse files Browse the repository at this point in the history
  • Loading branch information
ksanjeeb committed Dec 10, 2024
1 parent cecbc55 commit 9475e18
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 187 deletions.
63 changes: 0 additions & 63 deletions .github/ISSUE_TEMPLATE/bug_report.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

32 changes: 0 additions & 32 deletions .github/actions/setup-and-build/action.yaml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/ci.yaml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/semantic-pr.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions .husky/commit-msg

This file was deleted.

9 changes: 6 additions & 3 deletions app/lib/.server/llm/stream-text.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { streamText as _streamText, convertToCoreMessages } from 'ai';
import { getAPIKey } from '~/lib/.server/llm/api-key';
import { getAnthropicModel } from '~/lib/.server/llm/model';

import { MAX_TOKENS } from './constants';
import { getSystemPrompt } from './prompts';
import { createGroq } from '@ai-sdk/groq';


interface ToolResult<Name extends string, Args, Result> {
toolCallId: string;
Expand All @@ -21,9 +22,11 @@ export type Messages = Message[];

export type StreamingOptions = Omit<Parameters<typeof _streamText>[0], 'model'>;

const groq = createGroq();

export function streamText(messages: Messages, env: Env, options?: StreamingOptions) {
return _streamText({
model: getAnthropicModel(getAPIKey(env)),
model: groq(env.MODEL_NAME ?? 'gemma2-9b-it'),
system: getSystemPrompt(),
maxTokens: MAX_TOKENS,
headers: {
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"dependencies": {
"@ai-sdk/anthropic": "^0.0.39",
"@ai-sdk/groq": "^1.0.8",
"@codemirror/autocomplete": "^6.17.0",
"@codemirror/commands": "^6.6.0",
"@codemirror/lang-cpp": "^6.0.2",
Expand Down Expand Up @@ -58,6 +59,7 @@
"date-fns": "^3.6.0",
"diff": "^5.2.0",
"framer-motion": "^11.2.12",
"groq-sdk": "^0.9.0",
"isbot": "^4.1.0",
"istextorbinary": "^9.5.0",
"jose": "^5.6.3",
Expand Down Expand Up @@ -87,6 +89,7 @@
"is-ci": "^3.0.1",
"node-fetch": "^3.3.2",
"prettier": "^3.3.2",
"sass-embedded": "^1.82.0",
"typescript": "^5.5.2",
"unified": "^11.0.5",
"unocss": "^0.61.3",
Expand Down
2 changes: 2 additions & 0 deletions worker-configuration.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
interface Env {
ANTHROPIC_API_KEY: string;
MODEL_NAME: string;
GROQ_API_KEY: string;
}

0 comments on commit 9475e18

Please sign in to comment.