| Name | Type | Description |
|---|---|---|
chat_histories* | list[list[dict]] | A list of chat histories. Each chat history should be a list of messages. We recommend formatting these as OpenAI messages with a "role" and "content" key. Max length 1000 items. |
instructions | str | Default: DEFAULT_INSTRUCTIONSInstructions for the Insights agent. Should focus on what your agent does and what types of insights you want to generate. |
name | str | None | Default: None |
model | Literal['openai', 'anthropic'] | None | Default: None |
openai_api_key | str | None | Default: None |
anthropic_api_key | str | None | Default: None |
Generate Insights over your agent chat histories.
Example:
import os
from langsmith import Client
client = client()
chat_histories = [
[
{"role": "user", "content": "how are you"},
{"role": "assistant", "content": "good!"},
],
[
{"role": "user", "content": "do you like art"},
{"role": "assistant", "content": "only Tarkovsky"},
],
]
report = client.generate_insights(
chat_histories=chat_histories,
name="Conversation Topics",
instructions="What are the high-level topics of conversations users are having with the assistant?",
openai_api_key=os.environ["OPENAI_API_KEY"],
)
# client.poll_insights(report=report)Name for the generated Insights report.
Whether to use OpenAI or Anthropic models. This will impact the cost of generating the Insights Report.
OpenAI API key to use. Only needed if you have not already stored this in LangSmith as a workspace secret.
Anthropic API key to use. Only needed if you have not already stored this in LangSmith as a workspace secret.