Helicone Community Page

P
Pierre
Offline, last seen 2 months ago
Joined November 6, 2024
Hi @Justin , I'm having trouble enabling caching for anthropic. It works for open ai but not anthropic for some reason.
Here is my code:
Plain Text
headers = {
    "Helicone-Auth": "Bearer xxxx",
    **({
        "Helicone-Cache-Enabled": "true",
        "Cache-Control": "max-age=2592000"} if not os.environ.get('HELICONE_CACHE_DISABLED') else {}),
}

my_anthropic_client = Anthropic(
    base_url="https://anthropic.helicone.ai/",
    default_headers=headers
)

completion = my_anthropic_client.messages.create(
    max_tokens=4096,
    temperature=temperature,
    messages=conversation_state
    model=model_name
)

response = completion.content[0].text
9 comments
J
P
P
Pierre
·

Happy to Chat

Happy to chat
8 comments
J
P