├── .eslintignore
├── .github
├── assets
│ ├── logo-dark-mode.svg
│ └── logo-light-mode.svg
└── workflows
│ └── ci.yaml
├── .gitignore
├── .npmrc
├── .prettierignore
├── .prettierrc
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── apps
├── demo
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── app
│ │ ├── api
│ │ │ └── chat
│ │ │ │ └── route.ts
│ │ ├── chat
│ │ │ └── page.tsx
│ │ ├── favicon.ico
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ ├── page.tsx
│ │ └── providers
│ │ │ └── LoadingProvider.tsx
│ ├── components
│ │ ├── LLMSelector.tsx
│ │ └── Message.tsx
│ ├── next.config.js
│ ├── package.json
│ ├── postcss.config.js
│ ├── public
│ │ ├── next.svg
│ │ └── vercel.svg
│ ├── tailwind.config.ts
│ ├── tsconfig.json
│ └── utils
│ │ └── types.ts
└── docs
│ ├── .github
│ └── screenshot.png
│ ├── .gitignore
│ ├── LICENSE
│ ├── README.md
│ ├── assets
│ └── logo.svg
│ ├── components
│ ├── DynamicCodeExample.tsx
│ ├── counters.module.css
│ └── counters.tsx
│ ├── next-env.d.ts
│ ├── next.config.js
│ ├── package.json
│ ├── pages
│ ├── _app.tsx
│ ├── _meta.json
│ ├── index.mdx
│ └── providers-and-models
│ │ ├── _meta.json
│ │ ├── anthropic.mdx
│ │ ├── azure-openai.mdx
│ │ └── openai.mdx
│ ├── pnpm-lock.yaml
│ ├── postcss.config.js
│ ├── public
│ └── favicon
│ │ ├── android-chrome-192x192.png
│ │ ├── android-chrome-512x512.png
│ │ ├── apple-touch-icon.png
│ │ ├── favicon-16x16.png
│ │ ├── favicon-32x32.png
│ │ ├── favicon.ico
│ │ └── site.webmanifest
│ ├── styles
│ └── globals.css
│ ├── tailwind.config.js
│ ├── theme.config.tsx
│ └── tsconfig.json
├── package-lock.json
├── package.json
├── packages
├── eslint-config-custom
│ ├── README.md
│ ├── library.js
│ ├── next.js
│ ├── package.json
│ └── react-internal.js
├── llm-repo
│ ├── images
│ │ ├── anthropic.png
│ │ ├── azure.png
│ │ └── openai.png
│ ├── index.ts
│ ├── logos.ts
│ ├── package.json
│ └── tsconfig.json
├── tsconfig
│ ├── base.json
│ ├── nextjs.json
│ ├── package.json
│ └── react-library.json
└── unillm-node
│ ├── .eslintrc.json
│ ├── index.ts
│ ├── package.json
│ ├── providers
│ ├── anthropic.ts
│ ├── azure-openai.ts
│ ├── baseProvider.ts
│ └── openai.ts
│ ├── rollup.config.js
│ ├── tests
│ ├── anthropic.test.ts
│ ├── azure-openai.test.ts
│ ├── openai.test.ts
│ └── utils
│ │ ├── test-data.util.ts
│ │ └── validation.util.ts
│ ├── tsconfig.json
│ ├── turbo
│ └── generators
│ │ ├── config.ts
│ │ └── templates
│ │ └── component.hbs
│ ├── utils
│ ├── UnifiedErrorResponse.ts
│ ├── properties.ts
│ └── types.ts
│ └── vite.config.ts
├── tsconfig.json
└── turbo.json
/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 | apps/docs
--------------------------------------------------------------------------------
/.github/assets/logo-dark-mode.svg:
--------------------------------------------------------------------------------
1 |
547 |
--------------------------------------------------------------------------------
/.github/assets/logo-light-mode.svg:
--------------------------------------------------------------------------------
1 |
548 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yaml:
--------------------------------------------------------------------------------
1 | name: Continuous Integration
2 |
3 | on:
4 | workflow_dispatch:
5 | pull_request:
6 | branches:
7 | - "*"
8 | paths-ignore:
9 | - "**/*.md"
10 | - "docs"
11 | push:
12 | branches:
13 | - "*"
14 | paths-ignore:
15 | - "**/*.md"
16 | - "docs"
17 |
18 | jobs:
19 | ci:
20 | name: Continuous Integration
21 | runs-on: ubuntu-latest
22 | permissions:
23 | contents: read
24 | packages: write
25 | steps:
26 | - uses: actions/checkout@v3
27 | with:
28 | fetch-depth: 0
29 |
30 | - name: Cache node modules
31 | id: cache
32 | uses: actions/cache@v3
33 | with:
34 | path: |
35 | node_modules
36 | key: cache-node-modules-${{ hashFiles('**/package-lock.json') }}
37 |
38 | - uses: actions/setup-node@v3
39 | if: steps.cache.outputs.cache-hit != 'true'
40 | with:
41 | node-version: 18.x
42 |
43 | - name: Install Dependencies
44 | if: steps.cache.outputs.cache-hit != 'true'
45 | run: npm ci
46 |
47 | - name: Check Formatting
48 | run: npx prettier . --check
49 |
50 | - name: Lint
51 | run: npx turbo run lint
52 |
53 | - name: Test
54 | run: npx turbo run test
55 | env:
56 | OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
57 | ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
58 | AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
59 | AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
60 | AZURE_OPENAI_DEPLOYMENT: ${{ secrets.AZURE_OPENAI_DEPLOYMENT }}
61 |
62 | - name: Build
63 | run: npx turbo run build
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | node_modules
5 | .pnp
6 | .pnp.js
7 |
8 | # testing
9 | coverage
10 |
11 | # next.js
12 | .next/
13 | out/
14 | build
15 | dist
16 |
17 | # misc
18 | .DS_Store
19 | *.pem
20 |
21 | # debug
22 | npm-debug.log*
23 | yarn-debug.log*
24 | yarn-error.log*
25 |
26 | # local env files
27 | .env
28 | .env.local
29 | .env.development.local
30 | .env.test.local
31 | .env.production.local
32 |
33 | # turbo
34 | .turbo
35 |
36 | # vercel
37 | .vercel
38 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | auto-install-peers = true
2 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | # Add files here to ignore them from prettier formatting
2 | **/.next
3 | apps/docs
4 | **/dist
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": false
3 | }
4 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | We as members, contributors, and leaders pledge to make participation in our
6 | community a harassment-free experience for everyone, regardless of age, body
7 | size, visible or invisible disability, ethnicity, sex characteristics, gender
8 | identity and expression, level of experience, education, socio-economic status,
9 | nationality, personal appearance, race, religion, or sexual identity
10 | and orientation.
11 |
12 | We pledge to act and interact in ways that contribute to an open, welcoming,
13 | diverse, inclusive, and healthy community.
14 |
15 | ## Our Standards
16 |
17 | Examples of behavior that contributes to a positive environment for our
18 | community include:
19 |
20 | - Demonstrating empathy and kindness toward other people
21 | - Being respectful of differing opinions, viewpoints, and experiences
22 | - Giving and gracefully accepting constructive feedback
23 | - Accepting responsibility and apologizing to those affected by our mistakes,
24 | and learning from the experience
25 | - Focusing on what is best not just for us as individuals, but for the
26 | overall community
27 |
28 | Examples of unacceptable behavior include:
29 |
30 | - The use of sexualized language or imagery, and sexual attention or
31 | advances of any kind
32 | - Trolling, insulting or derogatory comments, and personal or political attacks
33 | - Public or private harassment
34 | - Publishing others' private information, such as a physical or email
35 | address, without their explicit permission
36 | - Other conduct which could reasonably be considered inappropriate in a
37 | professional setting
38 |
39 | ## Enforcement Responsibilities
40 |
41 | Community leaders are responsible for clarifying and enforcing our standards of
42 | acceptable behavior and will take appropriate and fair corrective action in
43 | response to any behavior that they deem inappropriate, threatening, offensive,
44 | or harmful.
45 |
46 | Community leaders have the right and responsibility to remove, edit, or reject
47 | comments, commits, code, wiki edits, issues, and other contributions that are
48 | not aligned to this Code of Conduct, and will communicate reasons for moderation
49 | decisions when appropriate.
50 |
51 | ## Scope
52 |
53 | This Code of Conduct applies within all community spaces, and also applies when
54 | an individual is officially representing the community in public spaces.
55 | Examples of representing our community include using an official e-mail address,
56 | posting via an official social media account, or acting as an appointed
57 | representative at an online or offline event.
58 |
59 | ## Enforcement
60 |
61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
62 | reported to the community leaders responsible for enforcement at
63 | hello@pezzo.ai.
64 | All complaints will be reviewed and investigated promptly and fairly.
65 |
66 | All community leaders are obligated to respect the privacy and security of the
67 | reporter of any incident.
68 |
69 | ## Enforcement Guidelines
70 |
71 | Community leaders will follow these Community Impact Guidelines in determining
72 | the consequences for any action they deem in violation of this Code of Conduct:
73 |
74 | ### 1. Correction
75 |
76 | **Community Impact**: Use of inappropriate language or other behavior deemed
77 | unprofessional or unwelcome in the community.
78 |
79 | **Consequence**: A private, written warning from community leaders, providing
80 | clarity around the nature of the violation and an explanation of why the
81 | behavior was inappropriate. A public apology may be requested.
82 |
83 | ### 2. Warning
84 |
85 | **Community Impact**: A violation through a single incident or series
86 | of actions.
87 |
88 | **Consequence**: A warning with consequences for continued behavior. No
89 | interaction with the people involved, including unsolicited interaction with
90 | those enforcing the Code of Conduct, for a specified period of time. This
91 | includes avoiding interactions in community spaces as well as external channels
92 | like social media. Violating these terms may lead to a temporary or
93 | permanent ban.
94 |
95 | ### 3. Temporary Ban
96 |
97 | **Community Impact**: A serious violation of community standards, including
98 | sustained inappropriate behavior.
99 |
100 | **Consequence**: A temporary ban from any sort of interaction or public
101 | communication with the community for a specified period of time. No public or
102 | private interaction with the people involved, including unsolicited interaction
103 | with those enforcing the Code of Conduct, is allowed during this period.
104 | Violating these terms may lead to a permanent ban.
105 |
106 | ### 4. Permanent Ban
107 |
108 | **Community Impact**: Demonstrating a pattern of violation of community
109 | standards, including sustained inappropriate behavior, harassment of an
110 | individual, or aggression toward or disparagement of classes of individuals.
111 |
112 | **Consequence**: A permanent ban from any sort of public interaction within
113 | the community.
114 |
115 | ## Attribution
116 |
117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118 | version 2.0.
119 |
120 | [homepage]: http://contributor-covenant.org
121 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | We opened sourced UniLLM because we believe in the power of community. We believe you can help making UniLLM better!
4 | We are excited to see what you will build with UniLLM and we are looking forward to your contributions. We want to make contributing to this project as easy and transparent as possible, whether it's features, bug fixes, documentation updates, guides, examples and more.
5 |
6 | ## How can I contribute?
7 |
8 | Ready to contribute but seeking guidance, we have several avenues to assist you. Explore the upcoming segment for clarity on the kind of contributions we appreciate and how to jump in. Reach out directly to the UniLLM team on [Discord](https://pezzo.cc/discord) for immediate assistance! Alternatively, you're welcome to raise an issue and one of our dedicated maintainers will promptly steer you in the right direction!
9 |
10 | ## Found a bug?
11 |
12 | If you find a bug in the source code, you can help us by [creating an issue](https://github.com/pezzolabs/unillm/issues/new) to our GitHub Repository. Even better, you can submit a Pull Request with a fix.
13 |
14 | ## Missing a feature?
15 |
16 | So, you've got an awesome feature in mind? Throw it over to us by [creating an issue](https://github.com/pezzolabs/unillm/issues/new) on our GitHub Repo.
17 |
18 | Planning to code a feature yourself? We love the enthusiasm, but hang on, always good to have a little chinwag with us before you burn that midnight oil. Unfortunately, not every feature might fit into our plans.
19 |
20 | - Dreaming big? Kick off by opening an issue and sketch out your cool ideas. Helps us all stay on the same page, avoid doing the same thing twice, and ensures your hard work gels well into the project.
21 | - Cooking up something small? Just craft it and [shoot it straight as a Pull Request](#submit-pr).
22 |
23 | ## What do you need to know to help?
24 |
25 | If you want to help out with a code contribution, our project uses the following stack:
26 |
27 | - TypeScript
28 | - Node.js
29 | - Various APIs/SDKs of LLM providers
30 |
31 | If you don't feel ready to make a code contribution yet, no problem! You can also improve our documentation.
32 |
33 | # How do I make a code contribution?
34 |
35 | ## Good first issues
36 |
37 | Are you new to open source contribution? Wondering how contributions work in our project? Here's a quick rundown.
38 |
39 | Find an issue that you're interested in addressing, or a feature that you'd like to add.
40 | You can use [this view](https://github.com/pezzolabs/unillm/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) which helps new contributors find easy gateways into our project.
41 |
42 | ## Step 1: Make a fork
43 |
44 | Fork the UniLLM repository to your GitHub organization/account. This means that you'll have a copy of the repository under _your-GitHub-username/repository-name_.
45 |
46 | ## Step 2: Clone the repository to your local machine
47 |
48 | ```
49 | git clone https://github.com/{your-GitHub-username}/unillm.git
50 |
51 | ```
52 |
53 | ## Step 3: Prepare the development environment
54 |
55 | Set up and run the development environment on your local machine:
56 |
57 | **BEFORE** you run the following steps make sure:
58 |
59 | 1. You have typescript installed locally on you machine `npm install -g typescript`
60 | 2. You are using node version: ^18.16.0 || ^14.0.0"
61 | 3. You are using npm version: ^8.1.0 || ^7.3.0"
62 | 4. You have `docker` installed and running on your machine
63 |
64 | ```shell
65 | cd unillm
66 | npm install
67 | ```
68 |
69 | ## Step 4: Create a branch
70 |
71 | Create a new branch for your changes.
72 | In order to keep branch names uniform and easy-to-understand, please use the following conventions for branch naming.
73 | Generally speaking, it is a good idea to add a group/type prefix to a branch.
74 | Here is a list of good examples:
75 |
76 | - for docs change : docs/{ISSUE_NUMBER}-{CUSTOM_NAME}
77 | - for new features : feat/{ISSUE_NUMBER}-{CUSTOM_NAME}
78 | - for bug fixes : fix/{ISSUE_NUMBER}-{CUSTOM_NAME}
79 |
80 | ```jsx
81 | git checkout -b branch-name-here
82 | ```
83 |
84 | ## Step 5: Make your changes
85 |
86 | Update the code with your bug fix or new feature.
87 |
88 | ## Step 6: Add the changes that are ready to be committed
89 |
90 | Stage the changes that are ready to be committed:
91 |
92 | ```jsx
93 | git add .
94 | ```
95 |
96 | ## Step 7: Commit the changes (Git)
97 |
98 | Commit the changes with a short message. (See below for more details on how we structure our commit messages)
99 |
100 | ```jsx
101 | git commit -m "(): "
102 | ```
103 |
104 | ## Step 8: Push the changes to the remote repository
105 |
106 | Push the changes to the remote repository using:
107 |
108 | ```jsx
109 | git push origin branch-name-here
110 | ```
111 |
112 | ## Step 9: Create Pull Request
113 |
114 | In GitHub, do the following to submit a pull request to the upstream repository:
115 |
116 | 1. Give the pull request a title and a short description of the changes made. Include also the issue or bug number associated with your change. Explain the changes that you made, any issues you think exist with the pull request you made, and any questions you have for the maintainer.
117 |
118 | Remember, it's okay if your pull request is not perfect (no pull request ever is). The reviewer will be able to help you fix any problems and improve it!
119 |
120 | 2. Wait for the pull request to be reviewed by a maintainer.
121 |
122 | 3. Make changes to the pull request if the reviewing maintainer recommends them.
123 |
124 | Celebrate your success after your pull request is merged :-)
125 |
126 | ## Git Commit Messages
127 |
128 | We structure our commit messages like this:
129 |
130 | ```
131 | ():
132 | ```
133 |
134 | Examples:
135 |
136 | ```
137 | fix(docs): fix title
138 | fix(unillm-node): better error handling
139 | ```
140 |
141 | ### Types:
142 |
143 | - **feat**: A new feature
144 | - **fix**: A bug fix
145 | - **docs**: Changes to the documentation
146 | - **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
147 | - **refactor**: A code change that neither fixes a bug nor adds a feature
148 | - **perf**: A code change that improves performance
149 | - **test**: Adding missing or correcting existing tests
150 | - **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation
151 |
152 | ### Packages:
153 |
154 | - **`unillm-node`**: Node.js SDK for UniLLM
155 | - **`apps/demo`**: Demo application
156 | - **`apps/docs`**: UniLLM's official documentation
157 |
158 | ## Code of conduct
159 |
160 | Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
161 |
162 | [Code of Conduct](https://github.com/pezzolabs/unillm/blob/main/CODE_OF_CONDUCT.md)
163 |
164 | Our Code of Conduct means that you are responsible for treating everyone on the project with respect and courtesy.
165 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Pezzo, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |