Skip to main content

Helicone

本页面介绍如何在LangChain中使用Helicone生态系统。

什么是Helicone?

Helicone是一个开源可观察性平台,它代理您的OpenAI流量,并为您提供有关支出、延迟和使用情况的关键洞察。

Screenshot of the Helicone dashboard showing average requests per day, response time, tokens per response, total cost, and a graph of requests over time.

快速开始

在您的LangChain环境中,您只需添加以下参数。

export OPENAI_API_BASE="https://oai.hconeai.com/v1"

现在前往 helicone.ai 创建您的账户,并在我们的仪表板中添加您的 OpenAI API 密钥以查看您的日志。

Interface for entering and managing OpenAI API keys in the Helicone dashboard.

如何启用 Helicone 缓存

from langchain_openai import OpenAI
import openai
openai.api_base = "https://oai.hconeai.com/v1"

llm = OpenAI(temperature=0.9, headers={"Helicone-Cache-Enabled": "true"})
text = "What is a helicone?"
print(llm.invoke(text))

Helicone 缓存文档

如何使用 Helicone 自定义属性

from langchain_openai import OpenAI
import openai
openai.api_base = "https://oai.hconeai.com/v1"

llm = OpenAI(temperature=0.9, headers={
"Helicone-Property-Session": "24",
"Helicone-Property-Conversation": "support_issue_2",
"Helicone-Property-App": "mobile",
})
text = "What is a helicone?"
print(llm.invoke(text))

Helicone 属性文档


Was this page helpful?


You can also leave detailed feedback on GitHub.

扫我,入群扫我,找书