/
githubmirror
/
devika
Обзор
Документация
Войти
/
githubmirror
/
devika
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/llm/claude_client.py
26 строк
644 B
ayush rajgor
Improve and Fix: response parser, invalid response and others (#522)
02 май 2024, 17:32
Не верифицирован
02 май 2024, 17:32
cdfb782
Код
Авторство
О чём код?
from anthropic import Anthropic from src.config import Config class Claude: def __init__(self): config = Config() api_key = config.get_claude_api_key() self.client = Anthropic( api_key=api_key, ) def inference(self, model_id: str, prompt: str) -> str: message = self.client.messages.create( max_tokens=4096, messages=[ { "role": "user", "content": prompt.strip(), } ], model=model_id, temperature=0 ) return message.content[0].text