mirror of
https://github.com/NovaOSS/nova-cord.git
synced 2024-11-25 20:43:56 +01:00
Updated NodeJS tutorial
This commit is contained in:
parent
33df5c3454
commit
2007b966d4
|
@ -102,9 +102,29 @@ curl https://api.nova-oss.com/v1/chat/completions \
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if how_can_i == 'use Node.js':
|
if how_can_i == 'use Node.js':
|
||||||
text = """Currently, the official node.js `openai` package doesn't support custom endpoints in their stable version,
|
text = """
|
||||||
but will probably change after the release of v4.0.0: https://github.com/openai/openai-node/discussions/182#discussioncomment-6335703.
|
```node
|
||||||
Meanwhile, you can just do "normal" requests like in curl without any package.
|
const OpenAI = require('openai');
|
||||||
|
|
||||||
|
const openai = new OpenAI({
|
||||||
|
apiKey: 'PUT_YOUR_NOVA_API_KEY_HERE',
|
||||||
|
baseURL: 'https://api.nova-oss.com/v1/',
|
||||||
|
});
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const completion = await openai.chat.completions.create({
|
||||||
|
messages: [
|
||||||
|
{ role: 'system', content: 'You are a helpful assistant.' },
|
||||||
|
{ role: 'user', content: 'What is the highest mountain?' }
|
||||||
|
],
|
||||||
|
model: 'gpt-3.5-turbo',
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(completion.choices);
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
|
```
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if how_can_i == 'program a Python Discord Bot with streaming':
|
if how_can_i == 'program a Python Discord Bot with streaming':
|
||||||
|
|
Loading…
Reference in a new issue