diff --git a/docs/mint.json b/docs/mint.json index 3f797730..622c6eff 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -84,6 +84,7 @@ "pages": [ "v1/integrations/crewai", "v1/integrations/autogen", + "v1/integrations/langchain", "v1/integrations/cohere", "v1/integrations/litellm" ] diff --git a/docs/v1/integrations/autogen.mdx b/docs/v1/integrations/autogen.mdx index 04922bfc..23ca4619 100644 --- a/docs/v1/integrations/autogen.mdx +++ b/docs/v1/integrations/autogen.mdx @@ -20,7 +20,7 @@ Autogen has comprehensive [documentation](https://microsoft.github.io/autogen/do ``` - [Give us a star](https://github.com/AgentOps-AI/agentops) on GitHub while you're at it (you may be our 1,000th 😊) + [Give us a star](https://github.com/AgentOps-AI/agentops) on GitHub while you're at it (you may be our 2,000th 😊) diff --git a/docs/v1/integrations/cohere.mdx b/docs/v1/integrations/cohere.mdx index 58e6071b..91b76d15 100644 --- a/docs/v1/integrations/cohere.mdx +++ b/docs/v1/integrations/cohere.mdx @@ -22,7 +22,7 @@ This is a living integration. Should you need any added functionality message us poetry add agentops ``` - [Give us a star](https://github.com/AgentOps-AI/agentops) on GitHub while you're at it (you may be our 1,000th 😊) + [Give us a star](https://github.com/AgentOps-AI/agentops) on GitHub while you're at it (you may be our 2,000th 😊) diff --git a/docs/v1/integrations/crewai.mdx b/docs/v1/integrations/crewai.mdx index 61f825c0..8b55bad2 100644 --- a/docs/v1/integrations/crewai.mdx +++ b/docs/v1/integrations/crewai.mdx @@ -25,7 +25,7 @@ Crew has comprehensive [documentation](https://docs.crewai.com) available as wel ``` - [Give us a star](https://github.com/AgentOps-AI/agentops) on GitHub while you're at it (you may be our 1,000th 😊) + [Give us a star](https://github.com/AgentOps-AI/agentops) on GitHub while you're at it (you may be our 2,000th 😊) diff --git a/docs/v1/integrations/langchain.mdx b/docs/v1/integrations/langchain.mdx new file mode 100644 index 00000000..6fef2008 --- /dev/null +++ b/docs/v1/integrations/langchain.mdx @@ -0,0 +1,110 @@ +--- +title: Langchain +description: "AgentOps provides first class support for Lanchain applications" +--- + +AgentOps works seamlessly with applications built using Langchain. + +## Adding AgentOps to Langchain applications + + + + + ```bash pip + pip install agentops + pip install agentops[langchain] + ``` + ```bash poetry + poetry add agentops + poetry add agentops[langchain] + ``` + + + [Give us a star](https://github.com/AgentOps-AI/agentops) on GitHub while you're at it (you may be our 2,000th 😊) + + + + Import the following Langchain and AgentOps dependencies + + ```python python + import os + from langchain.chat_models import ChatOpenAI + from langchain.agents import initialize_agent, AgentType + from agentops.langchain_callback_handler import LangchainCallbackHandler + ``` + + + For more features see our [Usage](/v1/usage) section. + + + + Set up your Langchain agent with the AgentOps callback handler and AgentOps will automatically record your Langchain sessions. + + ```python python + handler = LangchainCallbackHandler(api_key=AGENTOPS_API_KEY, tags=['Langchain Example']) + + llm = ChatOpenAI(openai_api_key=OPENAI_API_KEY, + callbacks=[handler], + model='gpt-3.5-turbo') + + agent = initialize_agent(tools, + llm, + agent=AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION, + verbose=True, + callbacks=[handler], # You must pass in a callback handler to record your agent + handle_parsing_errors=True) + ``` + + + Note that you don't need to set up a separate agentops.init() call, as the Langchain callback handler will automatically initialize the AgentOps client for you. + + + + Retrieve an API Key from your Settings > [Projects & API Keys](https://app.agentops.ai/settings/projects) page. + + + + + API keys are tied to individual projects.

+ A Default Project has been created for you, so just click Copy API Key +
+ Set this API Key in your [environment variables](/v1/usage/environment-variables) + ```python .env + AGENTOPS_API_KEY= + ``` +
+ + Execute your program and visit [app.agentops.ai/drilldown](https://app.agentops.ai/drilldown) to observe your Langchain Agent! 🕵️ + + After your run, AgentOps prints a clickable url to console linking directly to your session in the Dashboard + +
{/* Intentionally blank div for newline */} + + + + + + +## Full Examples + + + ```python python + import os + from langchain.chat_models import ChatOpenAI + from langchain.agents import initialize_agent, AgentType + from agentops.langchain_callback_handler import LangchainCallbackHandler + + handler = LangchainCallbackHandler(api_key=AGENTOPS_API_KEY, tags=['Langchain Example']) + + llm = ChatOpenAI(openai_api_key=OPENAI_API_KEY, + callbacks=[handler], + model='gpt-3.5-turbo') + + agent = initialize_agent(tools, + llm, + agent=AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION, + verbose=True, + callbacks=[handler], # You must pass in a callback handler to record your agent + handle_parsing_errors=True) + ``` + \ No newline at end of file diff --git a/docs/v1/introduction.mdx b/docs/v1/introduction.mdx index f043ba88..3c470b0f 100644 --- a/docs/v1/introduction.mdx +++ b/docs/v1/introduction.mdx @@ -4,7 +4,7 @@ description: "Build your next agent with evals, observability, and replays" mode: "wide" --- -[Give us a star](https://github.com/AgentOps-AI/agentops) on GitHub if you find AgentOps helpful (you may be our 1,000th 😊) +[Give us a star](https://github.com/AgentOps-AI/agentops) on GitHub if you find AgentOps helpful (you may be our 2,000th 😊) # AgentOps is your new terminal diff --git a/docs/v1/quickstart.mdx b/docs/v1/quickstart.mdx index 1a1d9bbe..a85f5b71 100644 --- a/docs/v1/quickstart.mdx +++ b/docs/v1/quickstart.mdx @@ -14,7 +14,6 @@ import SupportedModels from '/snippets/supported-models.mdx' poetry add agentops ``` - [Give us a star](https://github.com/AgentOps-AI/agentops) on GitHub while you're at it (you may be our 1,000th 😊) @@ -61,7 +60,7 @@ import SupportedModels from '/snippets/supported-models.mdx' - +[Give us a star](https://github.com/AgentOps-AI/agentops) on GitHub if you found AgentOps helpful (you may be our 2,000th 😊) ## More basic functionality