20 lines
598 B
Python
20 lines
598 B
Python
from anthropic import Anthropic
|
|
import os
|
|
|
|
def call_llm(prompt):
|
|
client = Anthropic(api_key=os.environ.get("ANTHROPIC_API_KEY", "your-api-key"))
|
|
response = client.messages.create(
|
|
model="claude-sonnet-4-20250514",
|
|
max_tokens=6000,
|
|
messages=[
|
|
{"role": "user", "content": prompt}
|
|
]
|
|
)
|
|
return response.content[0].text
|
|
|
|
if __name__ == "__main__":
|
|
print("## Testing call_llm")
|
|
prompt = "In a few words, what is the meaning of life?"
|
|
print(f"## Prompt: {prompt}")
|
|
response = call_llm(prompt)
|
|
print(f"## Response: {response}") |