forked from phoenix/litellm-mirror
make it easy for people to use sk-litellm
This commit is contained in:
parent
633e36de42
commit
e6a022ea9e
5 changed files with 69 additions and 27 deletions
|
@ -1,6 +1,8 @@
|
||||||
|
import TokenGen from '../src/components/TokenGen.js'
|
||||||
|
|
||||||
# 🚨 LITELLM API (Access Claude-2/Llama2-70b/etc.)
|
# 🚨 LITELLM API (Access Claude-2/Llama2-70b/etc.)
|
||||||
|
|
||||||
This is an api built for the Open Interpreter community. It provides access to:
|
Use this if you're trying to add support for new LLMs and need access for testing:
|
||||||
* OpenAI models
|
* OpenAI models
|
||||||
* gpt-4
|
* gpt-4
|
||||||
* gpt-3.5-turbo
|
* gpt-3.5-turbo
|
||||||
|
@ -31,28 +33,30 @@ This is an api built for the Open Interpreter community. It provides access to:
|
||||||
|
|
||||||
Here's how to call it:
|
Here's how to call it:
|
||||||
|
|
||||||
## Through LiteLLM
|
## Step 1: Save your LiteLLM API Key
|
||||||
```python
|
|
||||||
|
This is your unique LiteLLM API Key. Save this for later use.
|
||||||
|
<TokenGen/>
|
||||||
|
|
||||||
|
## Step 2: Test a new LLM
|
||||||
|
|
||||||
|
Now let's test if claude-2 is working in our code
|
||||||
|
```
|
||||||
from litellm import completion
|
from litellm import completion
|
||||||
import os
|
import os
|
||||||
## set ENV variables
|
|
||||||
os.environ["OPENAI_API_KEY"] = "litellm-api-key"
|
|
||||||
|
|
||||||
messages = [{ "content": "Hello, how are you?","role": "user"}]
|
# set env var
|
||||||
|
os.environ["ANTHROPIC_API_KEY"] = "sk-litellm-1234" # 👈 replace with your unique key
|
||||||
|
|
||||||
|
messages = [{"role": "user", "content": "Hey, how's it going?"}]
|
||||||
|
|
||||||
|
response = completion(model="claude-2", messages=messages)
|
||||||
|
|
||||||
response = completion(
|
|
||||||
model="command-nightly",
|
|
||||||
messages=[{ "content": "Hello, how are you?","role": "user"}],
|
|
||||||
api_base="https://proxy.litellm.ai",
|
|
||||||
custom_llm_provider="openai",
|
|
||||||
temperature=0.2,
|
|
||||||
max_tokens=80,
|
|
||||||
)
|
|
||||||
print(response)
|
print(response)
|
||||||
```
|
```
|
||||||
|
|
||||||
## In CodeInterpreter
|
## For OpenInterpreter
|
||||||
|
This was initially built for the Open Interpreter community. If you're trying to use this feature in there, here's how you can do it:
|
||||||
**Note**: You will need to clone and modify the Github repo, until [this PR is merged.](https://github.com/KillianLucas/open-interpreter/pull/288)
|
**Note**: You will need to clone and modify the Github repo, until [this PR is merged.](https://github.com/KillianLucas/open-interpreter/pull/288)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
12
docs/my-website/package-lock.json
generated
12
docs/my-website/package-lock.json
generated
|
@ -18,7 +18,7 @@
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"sharp": "^0.32.5",
|
"sharp": "^0.32.5",
|
||||||
"uuid": "^9.0.0"
|
"uuid": "^9.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@docusaurus/module-type-aliases": "2.4.1"
|
"@docusaurus/module-type-aliases": "2.4.1"
|
||||||
|
@ -12823,9 +12823,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/uuid": {
|
"node_modules/uuid": {
|
||||||
"version": "9.0.0",
|
"version": "9.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
|
||||||
"integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==",
|
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
|
||||||
|
"funding": [
|
||||||
|
"https://github.com/sponsors/broofa",
|
||||||
|
"https://github.com/sponsors/ctavan"
|
||||||
|
],
|
||||||
"bin": {
|
"bin": {
|
||||||
"uuid": "dist/bin/uuid"
|
"uuid": "dist/bin/uuid"
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"sharp": "^0.32.5",
|
"sharp": "^0.32.5",
|
||||||
"uuid": "^9.0.0"
|
"uuid": "^9.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@docusaurus/module-type-aliases": "2.4.1"
|
"@docusaurus/module-type-aliases": "2.4.1"
|
||||||
|
|
34
docs/my-website/src/components/TokenGen.js
Normal file
34
docs/my-website/src/components/TokenGen.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
import React, { useState, useEffect } from 'react';
|
||||||
|
import {v4 as uuidv4} from 'uuid';
|
||||||
|
|
||||||
|
const CodeBlock = ({ token }) => {
|
||||||
|
const codeWithToken = `${token}`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<pre>
|
||||||
|
{token ? codeWithToken : ""}
|
||||||
|
</pre>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const TokenGen = () => {
|
||||||
|
const [token, setToken] = useState(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const generateToken = () => {
|
||||||
|
// Generate a special uuid/token "sk-litellm-<uuid>"
|
||||||
|
const newToken = `sk-litellm-${uuidv4()}`;
|
||||||
|
setToken(newToken);
|
||||||
|
};
|
||||||
|
|
||||||
|
generateToken();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<CodeBlock token={token} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TokenGen;
|
|
@ -7954,10 +7954,10 @@ uuid@^8.3.2:
|
||||||
resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz"
|
resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz"
|
||||||
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
||||||
|
|
||||||
uuid@^9.0.0:
|
uuid@^9.0.1:
|
||||||
version "9.0.0"
|
version "9.0.1"
|
||||||
resolved "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz"
|
resolved "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz"
|
||||||
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
|
integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==
|
||||||
|
|
||||||
value-equal@^1.0.1:
|
value-equal@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue