Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
arielweinberger committed Oct 22, 2023
1 parent 228947d commit 567118f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
[homepage]: http://contributor-covenant.org
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
</p>

# 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
Expand All @@ -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
```
Expand All @@ -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: ...,
Expand All @@ -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).
This repository's source code is available under the [MIT](LICENSE).
18 changes: 9 additions & 9 deletions packages/llm-repo/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export type ProviderDefinition = {
name: string;
}
};

export const providers: {
[key: string]: ProviderDefinition;
Expand All @@ -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
Expand All @@ -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;
export type Model = keyof typeof models;
8 changes: 4 additions & 4 deletions packages/llm-repo/logos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
};
3 changes: 3 additions & 0 deletions packages/llm-repo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"main": "./index.tsx",
"types": "./index.tsx",
"license": "MIT",
"scripts": {
"format": "prettier . --write"
},
"devDependencies": {
"eslint-config-custom": "*",
"tsconfig": "*"
Expand Down
2 changes: 1 addition & 1 deletion packages/llm-repo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"extends": "tsconfig/base.json",
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
}
}

0 comments on commit 567118f

Please sign in to comment.