Skip to content

Commit

Permalink
docs(user_keys.md): add openai js example to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
krrishdholakia committed Jul 14, 2024
1 parent 6bf60d7 commit fe6ea9f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/my-website/docs/proxy/pass_through.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ general_settings:
Allow developers to call the proxy with Anthropic/boto3/etc. client sdk's.
Use our [Anthropic Adapter](https://github.com/BerriAI/litellm/blob/fd743aaefd23ae509d8ca64b0c232d25fe3e39ee/litellm/adapters/anthropic_adapter.py#L50) for reference
Test our [Anthropic Adapter](../anthropic_completion.md) for reference [**Code**](https://github.com/BerriAI/litellm/blob/fd743aaefd23ae509d8ca64b0c232d25fe3e39ee/litellm/adapters/anthropic_adapter.py#L50)
### 1. Write an Adapter
Expand Down
27 changes: 27 additions & 0 deletions docs/my-website/docs/proxy/user_keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,33 @@ console.log(message);

```

</TabItem>
<TabItem value="openai JS" label="OpenAI JS">

```js
const { OpenAI } = require('openai');

const openai = new OpenAI({
apiKey: "sk-1234", // This is the default and can be omitted
baseURL: "http://0.0.0.0:4000"
});

async function main() {
const chatCompletion = await openai.chat.completions.create({
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'gpt-3.5-turbo',
}, {"metadata": {
"generation_name": "ishaan-generation-openaijs-client",
"generation_id": "openaijs-client-gen-id22",
"trace_id": "openaijs-client-trace-id22",
"trace_user_id": "openaijs-client-user-id2"
}});
}

main();

```

</TabItem>
<TabItem value="instructor" label="Instructor">

Expand Down

0 comments on commit fe6ea9f

Please sign in to comment.