chore: code cleaning (#21)
This commit is contained in:
19
utils/anthropicClient.ts
Normal file
19
utils/anthropicClient.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import Anthropic from '@anthropic-ai/sdk';
|
||||
|
||||
export async function getMessage(text: string) {
|
||||
const anthropic = new Anthropic({
|
||||
apiKey: process.env.ANTHROPIC_API_KEY
|
||||
});
|
||||
|
||||
console.log('Anthropic request with text: ', text);
|
||||
|
||||
const response = await anthropic.messages.create({
|
||||
model: 'claude-3-5-sonnet-20240620',
|
||||
max_tokens: 1024,
|
||||
messages: [{ role: 'user', content: text }]
|
||||
});
|
||||
|
||||
console.log('Anthropic response: ', response);
|
||||
|
||||
return response;
|
||||
}
|
||||
Reference in New Issue
Block a user