anthropic公司发布的python sdk,调用 Claude 3模型,对标 GPT4
pip install anthropic
from anthropic import Anthropic
client = Anthropic()
MODEL_NAME = "claude-3-opus-20240229"
def get_completion(messages):
response = client.messages.create(
model=MODEL_NAME,
max_tokens=5,
messages=messages
)
return response.content[0].text
# Get completions for each question in the eval.
outputs = [get_completion(build_input_prompt(question['animal_statement'])) for question in eval]