update cmd to cli

This commit is contained in:
zachary62
2025-06-01 17:45:14 -04:00
parent 6cf3ec4984
commit 02ff1e7e9b
9 changed files with 2 additions and 2 deletions
@@ -0,0 +1,24 @@
from anthropic import Anthropic
import os
def call_llm(prompt: str) -> str:
client = Anthropic(api_key=os.environ.get("ANTHROPIC_API_KEY", "your-anthropic-api-key")) # Default if key not found
response = client.messages.create(
model="claude-3-haiku-20240307", # Using a smaller model for jokes
max_tokens=150, # Jokes don't need to be very long
messages=[
{"role": "user", "content": prompt}
]
)
return response.content[0].text
if __name__ == "__main__":
print("Testing Anthropic LLM call for jokes:")
joke_prompt = "Tell me a one-liner joke about a cat."
print(f"Prompt: {joke_prompt}")
try:
response = call_llm(joke_prompt)
print(f"Response: {response}")
except Exception as e:
print(f"Error calling LLM: {e}")
print("Please ensure your ANTHROPIC_API_KEY environment variable is set correctly.")