Skip to content

Commit

Permalink
anthropic support added
Browse files Browse the repository at this point in the history
  • Loading branch information
cdreetz committed Aug 20, 2024
1 parent 27d92a2 commit 4efd562
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 4 deletions.
5 changes: 4 additions & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ResultsTable from '@/components/ResultsTable'
import { Alert, AlertDescription } from '@/components/ui/alert'
import InfoButton from '@/components/InfoButton';

export type Provider = 'openai' | 'groq';
export type Provider = 'openai' | 'groq' | 'anthropic';

export interface Model {
id: string;
Expand All @@ -28,6 +28,9 @@ const AVAILABLE_MODELS: Model[] = [
{ id: 'mixtral-8x7b-32768', name: 'Mixtral 8x7b', provider: 'groq' },
{ id: 'gemma-7b-it', name: 'Gemma 7b', provider: 'groq' },
{ id: 'gemma2-9b-it', name: 'Gemma2 9b', provider: 'groq' },
{ id: 'claude-3-opus-20240229', name: 'Claude 3 Opus', provider: 'anthropic' },
{ id: 'claude-3-haiku-20240307', name: 'Claude 3 Haiku', provider: 'anthropic' },
{ id: 'claude-3-sonnet-20240229', name: 'Claude 3 Sonnet', provider: 'anthropic' },
];

interface EvaluationResult {
Expand Down
4 changes: 3 additions & 1 deletion app/registry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createOpenAI } from "@ai-sdk/openai";
import { anthropic } from "@ai-sdk/anthropic";
import { experimental_createProviderRegistry as createProviderRegistry } from "ai";

export function createServerRegistry(){
Expand All @@ -11,7 +12,8 @@ export function createServerRegistry(){
})
return createProviderRegistry({
openai: openai,
groq: groq
groq: groq,
anthropic: anthropic
});
}

Expand Down
2 changes: 1 addition & 1 deletion components/PromptInputForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function PromptInputForm({ prompts, onPromptsChange }: PromptInpu
{prompts.length > 0 && (
<div>
<h3 className="text-lg font-meduim mb-2">Added Prompts:</h3>
<ScrollArea className="h-[200px] w-full border rounded-md p-4">
<ScrollArea className="h-[150px] w-full border rounded-md p-4">
<ul className="space-y-2">
{prompts.map((prompt, index) => (
<li key={index} className="bg-secondary p-2 rounded">{prompt}</li>
Expand Down
2 changes: 1 addition & 1 deletion hooks/useMultiProviderChat.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useChat, UseChatOptions } from 'ai/react';

export type Provider = 'openai' | 'groq';
export type Provider = 'openai' | 'groq' | 'anthropic';

export interface Model {
id: string;
Expand Down
66 changes: 66 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@ai-sdk/anthropic": "^0.0.44",
"@ai-sdk/openai": "^0.0.39",
"@radix-ui/react-alert-dialog": "^1.1.1",
"@radix-ui/react-checkbox": "^1.1.1",
Expand Down

0 comments on commit 4efd562

Please sign in to comment.