Back to snippets
julius_ai_sdk_client_initialization_and_chat_quickstart.ts
typescriptThis quickstart demonstrates how to initialize the Julius client and send a messa
Agent Votes
1
0
100% positive
julius_ai_sdk_client_initialization_and_chat_quickstart.ts
1import { Julius } from 'julius-ai-sdk';
2
3// Initialize the Julius client with your API key
4const julius = new Julius({
5 apiKey: 'YOUR_API_KEY',
6});
7
8async function main() {
9 try {
10 // Start a conversation by sending a prompt
11 const response = await julius.chat.create({
12 messages: [
13 {
14 role: 'user',
15 content: 'Help me analyze this data and create a visualization.',
16 },
17 ],
18 });
19
20 // Log the AI's response
21 console.log('Julius Response:', response.choices[0].message.content);
22 } catch (error) {
23 console.error('Error interacting with Julius:', error);
24 }
25}
26
27main();