forked from phoenix/litellm-mirror
update
This commit is contained in:
parent
f6823cf545
commit
480281e2f9
2 changed files with 1 additions and 59 deletions
|
@ -2,65 +2,7 @@
|
||||||
displayed_sidebar: tutorialSidebar
|
displayed_sidebar: tutorialSidebar
|
||||||
---
|
---
|
||||||
# litellm
|
# litellm
|
||||||
import { useState, useEffect } from 'react';
|
import QueryParamReader from '../src/components/queryParamReader.js'
|
||||||
|
|
||||||
const CodeBlock = ({ token }) => {
|
|
||||||
const codeWithToken = `
|
|
||||||
from litellm import completion
|
|
||||||
|
|
||||||
# set ENV variables
|
|
||||||
os.environ["LITELLM_TOKEN"] = '${token}'
|
|
||||||
|
|
||||||
messages = [{ "content": "Hello, how are you?","role": "user"}]
|
|
||||||
|
|
||||||
# openai call
|
|
||||||
response = completion(model="gpt-3.5-turbo", messages=messages)
|
|
||||||
|
|
||||||
# cohere call
|
|
||||||
response = completion("command-nightly", messages)
|
|
||||||
`;
|
|
||||||
|
|
||||||
const codeWithoutToken = `
|
|
||||||
from litellm import completion
|
|
||||||
|
|
||||||
## set ENV variables
|
|
||||||
os.environ["OPENAI_API_KEY"] = "openai key"
|
|
||||||
os.environ["COHERE_API_KEY"] = "cohere key"
|
|
||||||
|
|
||||||
|
|
||||||
messages = [{ "content": "Hello, how are you?","role": "user"}]
|
|
||||||
|
|
||||||
# openai call
|
|
||||||
response = completion(model="gpt-3.5-turbo", messages=messages)
|
|
||||||
|
|
||||||
# cohere call
|
|
||||||
response = completion("command-nightly", messages)
|
|
||||||
`;
|
|
||||||
return (
|
|
||||||
<pre>
|
|
||||||
{console.log("token: ", token)}
|
|
||||||
{token ? codeWithToken : codeWithoutToken}
|
|
||||||
</pre>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const QueryParamReader = () => {
|
|
||||||
const [token, setToken] = useState(null);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
|
||||||
const token = urlParams.get('token');
|
|
||||||
setToken(token);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<CodeBlock token={token} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default QueryParamReader;
|
|
||||||
|
|
||||||
[](https://pypi.org/project/litellm/)
|
[](https://pypi.org/project/litellm/)
|
||||||
[](https://pypi.org/project/litellm/0.1.1/)
|
[](https://pypi.org/project/litellm/0.1.1/)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue