diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index eb109fb..403a5a6 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -117,4 +117,4 @@ the community. This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0. -[homepage]: http://contributor-covenant.org \ No newline at end of file +[homepage]: http://contributor-covenant.org diff --git a/README.md b/README.md index 832f44f..a3fd6d0 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@

# Benefits + - ✨ Integrate with any provider and model using the OpenAI API - 💬 Consistent chatCompletion responses and logs across all models and providers - 💯 Type safety across all providers and models @@ -44,7 +45,6 @@ With UniLLM, you can use chat completions even for providers/models that don't natively support it (e.g. Anthropic). - ```bash npm i unillm ``` @@ -67,12 +67,13 @@ const response = await uniLLM.createChatCompletion("azure:openai", { messages: . // More coming soon! ``` -Want to see more examples? Check out the **[interactive docs](https://docs.unillm.ai)**. +Want to see more examples? Check out the **[interactive docs](https://docs.unillm.ai)**. ## ⚡️ Streaming To enable streaming, simply provide `stream: true` in the options object. Here is an example: + ```ts const response = await uniLLM.createChatCompletion("openai:gpt-3.5-turbo", { messages: ..., @@ -92,4 +93,4 @@ Please check out [CONTRIBUTING.md](CONTRIBUTING.md) before contributing. # License -This repository's source code is available under the [MIT](LICENSE). \ No newline at end of file +This repository's source code is available under the [MIT](LICENSE). diff --git a/packages/llm-repo/index.ts b/packages/llm-repo/index.ts index 4dd4017..ed3392d 100644 --- a/packages/llm-repo/index.ts +++ b/packages/llm-repo/index.ts @@ -1,6 +1,6 @@ export type ProviderDefinition = { name: string; -} +}; export const providers: { [key: string]: ProviderDefinition; @@ -22,7 +22,7 @@ export type ModelDefinition = { provider: keyof typeof providers; name: string; setup: string; -} +}; const openaiSetup = ` Make sure the following environment variables are set: OPENAI_API_KEY - your OpenAI API key @@ -39,33 +39,33 @@ const azureSetup = ` Make sure the following environment variables are set: `; export const models: { - [key: string]: ModelDefinition + [key: string]: ModelDefinition; } = { "openai:gpt-3.5-turbo": { provider: "openai", name: "GPT-3.5 Turbo", - setup: openaiSetup + setup: openaiSetup, }, "openai:gpt-4": { provider: "openai", name: "GPT-4", - setup: openaiSetup + setup: openaiSetup, }, "anthropic:claude-2": { provider: "anthropic", name: "Claude 2", - setup: anthropicSetup + setup: anthropicSetup, }, "anthropic:claude-1-instant": { provider: "anthropic", name: "Claude 1 Instant", - setup: anthropicSetup + setup: anthropicSetup, }, "azure:openai": { provider: "azure", name: "Azure OpenAI", - setup: azureSetup + setup: azureSetup, }, }; -export type Model = keyof typeof models; \ No newline at end of file +export type Model = keyof typeof models; diff --git a/packages/llm-repo/logos.ts b/packages/llm-repo/logos.ts index b8a8742..74939c5 100644 --- a/packages/llm-repo/logos.ts +++ b/packages/llm-repo/logos.ts @@ -7,11 +7,11 @@ import { Provider } from "./index"; export const providerToLogoMapping: { [key in Provider]: any; } = { - "openai": OpenAILogo, - "anthropic": AnthropicLogo, - "azure": AzureLogo, + openai: OpenAILogo, + anthropic: AnthropicLogo, + azure: AzureLogo, }; export const getProviderLogo = (provider: Provider) => { return providerToLogoMapping[provider]; -} \ No newline at end of file +}; diff --git a/packages/llm-repo/package.json b/packages/llm-repo/package.json index f1663b3..e5baebe 100644 --- a/packages/llm-repo/package.json +++ b/packages/llm-repo/package.json @@ -4,6 +4,9 @@ "main": "./index.tsx", "types": "./index.tsx", "license": "MIT", + "scripts": { + "format": "prettier . --write" + }, "devDependencies": { "eslint-config-custom": "*", "tsconfig": "*" diff --git a/packages/llm-repo/tsconfig.json b/packages/llm-repo/tsconfig.json index f3883a1..37906aa 100644 --- a/packages/llm-repo/tsconfig.json +++ b/packages/llm-repo/tsconfig.json @@ -2,4 +2,4 @@ "extends": "tsconfig/base.json", "include": ["."], "exclude": ["dist", "build", "node_modules"] -} \ No newline at end of file +}