import type { AthenaIntelligence } from '@athenaintel/sdk';
import { AthenaIntelligenceClient, AthenaIntelligenceError } from '@athenaintel/sdk';
async function runDirectModelExample() {
try {
const client = new AthenaIntelligenceClient({
apiKey: process.env.ATHENA_API_KEY,
// Optional: override baseUrl for custom environments
// baseUrl: 'https://your-custom-api.example.com',
});
// Simple text generation request
const request: AthenaIntelligence.GeneralAgentRequest = {
config: {
model: 'gpt-4-turbo-preview',
},
messages: [
{
content: 'You are a creative writing assistant.',
role: 'system',
type: 'system',
},
{
content: 'Write a short story about a robot learning to paint',
role: 'user',
type: 'user',
},
],
};
console.log('Sending request to model...');
const response = await client.agents.general.invoke(request);
console.log('Response received:');
console.log(JSON.stringify(response, null, 2));
} catch (error) {
if (error instanceof AthenaIntelligenceError) {
console.error(`Athena API error (${error.statusCode}): ${error.message}`);
} else {
console.error('Unexpected error:', error);
}
}
}
runDirectModelExample();