-
Notifications
You must be signed in to change notification settings - Fork 512
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Contact Details
No response
π¦ Package Version
0.3.26
ποΈ Framework Version
No response
π Describe the Bug
Was testing completions.create from Anthropic, and it seems like it's not tracking cost.
Reference script:
import agentops
from anthropic import Anthropic
agentops.init(
api_key='<AGENTOPS_KEY>',
default_tags=['anthropic']
)
client = Anthropic(api_key='<ANTHROPIC_KEY>')
models = ["claude-2"]
def get_ai_response(model_name):
response = client.completions.create(
model=model_name,
prompt="\n\nHuman: Write a haiku about AI and humans working together\n\nAssistant:",
max_tokens_to_sample=100
)
return response.completion
for model in models:
print(f"Response from {model}:")
try:
ai_response = get_ai_response(model)
print(ai_response)
except Exception as e:
print(f"Error with model {model}: {e}")
print("-" * 50)
agentops.end_session('Success')
π€ Contribution
- Yes, I'd be happy to submit a pull request with these changes.
- I need some guidance on how to contribute.
- I'd prefer the AgentOps team to handle this update.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working