avatarLaxfed Paulacy

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

2051

Abstract

s="hljs-comment"># Dive into the agent loops</span> <span class="hljs-keyword">debugger</span>.inspect_agent_loops()</pre></div><h2 id="485d">Testing</h2><p id="1759">Testing LLM applications without LangSmith is like trying to assemble IKEA furniture without the manual: sure, you could wing it, but do you really want to risk it? Baked into LangSmith is the option to utilize existing datasets or create new ones, and run them against your chains.</p><div id="f185"><pre><span class="hljs-comment"># Example of using LangSmith for testing</span> <span class="hljs-keyword">from</span> langsmith <span class="hljs-keyword">import</span> TestingTools

<span class="hljs-comment"># Instantiate the testing tools</span> tester = TestingTools()

<span class="hljs-comment"># Run existing datasets against your chains</span> tester.run_existing_datasets()</pre></div><h2 id="aa92">Evaluating</h2><p id="6bb1">Beyond mere testing, evaluation in LangSmith delves into the performance nuances of LLM runs. While the built-in evaluators offer a preliminary analysis, the true power lies in guiding your focus towards crucial examples.</p><div id="9609"><pre># Example <span class="hljs-keyword">of</span> <span class="hljs-keyword">using</span> LangSmith <span class="hljs-keyword">for</span> evaluation <span class="hljs-keyword">from</span> langsmith <span class="hljs-keyword">import</span> EvaluationTools

Instantiate the evaluation tools

evaluator = EvaluationTools()

<span class="hljs-keyword">Perform</span> a comprehensive evaluation

evaluator.perform_comprehensive_evaluation()</pre></div><h2 id="1469">Monitoring</h2><p id="0137">Think of LangSmith’s monitoring as your AI’s babysitter: always vigilant, never distracted, and ready to report every little mischief.</p><div id="81b9"><pre><span class="hljs-comment"># Example of using LangSmith for monitoring</span> from langsmith import MonitoringTools

<span class="hljs-comment"># Instantiate the monitoring tools</span><span class="hljs-built_in"> monitor </span>= MonitoringTools()

<span

Options

class="hljs-comment"># Keep an eye on your AI's behavior</span> monitor.keep_watch()</pre></div><p id="e7cc">LangChain is the muscle doing the heavy lifting with Chains, Prompts, and Agents, while LangSmith acts as an AI compass built into LangChain, guiding users through the intricate decision pathways and results that AI generates. Traces in the world of LangSmith are analogous to logs when programming; they allow us to easily see what text came in and out of chains and LLMs. Think of them as detailed breadcrumbs illuminating the AI’s journey.</p><div id="9aa4"><pre><span class="hljs-comment"># Example of accessing LangSmith traces</span> <span class="hljs-keyword">from</span> langsmith <span class="hljs-keyword">import</span> Traces

<span class="hljs-comment"># Access the traces</span> traces = Traces()

<span class="hljs-comment"># Retrieve and analyze individual traces</span> traces.analyze_individual_trace()</pre></div><p id="a82d">LangSmith is not just a tool, but a critical inclusion in the stack of many AI product teams. Leveraging LangSmith alongside LangChain offers a comprehensive solution for managing LLM applications, ensuring reliability, and enabling continuous improvement based on granular AI insights and user feedback.</p><div id="d5c9" class="link-block"> <a href="https://readmedium.com/langchain-how-to-safely-query-enterprise-data-with-langchain-agents-sql-openai-gretel-0a85c5a758e4"> <div> <div> <h2>LANGCHAIN — How to Safely Query Enterprise Data with Langchain Agents SQL OpenAI Gretel</h2> <div><h3>Software is like entropy: It is difficult to grasp, weighs nothing, and obeys the Second Law of Thermodynamics; i.e…</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*nu7ZXSdSXeo6aCLEJYoZpg.jpeg)"></div> </div> </div> </a> </div></article></body>

LANGCHAIN — Peering Into the Soul of AI Decision-Making with Langsmith

Software is a great combination between artistry and engineering. — Bill Gates

LangSmith is a powerful framework designed to track the inner workings of LLMs and AI agents within your product. It provides debugging, testing, evaluating, and monitoring tools to ensure the reliability and quality of AI outputs. Here’s a breakdown of how LangSmith works in unison and what you can expect:

Debugging

When your LLM starts throwing curveballs instead of answers, you don’t just want to sit there catching them. With LangSmith, you can roll up your sleeves and play detective. We use the debugging tools to dive into perplexing agent loops, frustratingly slow chains, and to scrutinize prompts like they’re suspects in a lineup.

# Example of using LangSmith for debugging
from langsmith import DebuggingTools

# Instantiate the debugging tools
debugger = DebuggingTools()

# Dive into the agent loops
debugger.inspect_agent_loops()

Testing

Testing LLM applications without LangSmith is like trying to assemble IKEA furniture without the manual: sure, you could wing it, but do you really want to risk it? Baked into LangSmith is the option to utilize existing datasets or create new ones, and run them against your chains.

# Example of using LangSmith for testing
from langsmith import TestingTools

# Instantiate the testing tools
tester = TestingTools()

# Run existing datasets against your chains
tester.run_existing_datasets()

Evaluating

Beyond mere testing, evaluation in LangSmith delves into the performance nuances of LLM runs. While the built-in evaluators offer a preliminary analysis, the true power lies in guiding your focus towards crucial examples.

# Example of using LangSmith for evaluation
from langsmith import EvaluationTools

# Instantiate the evaluation tools
evaluator = EvaluationTools()

# Perform a comprehensive evaluation
evaluator.perform_comprehensive_evaluation()

Monitoring

Think of LangSmith’s monitoring as your AI’s babysitter: always vigilant, never distracted, and ready to report every little mischief.

# Example of using LangSmith for monitoring
from langsmith import MonitoringTools

# Instantiate the monitoring tools
monitor = MonitoringTools()

# Keep an eye on your AI's behavior
monitor.keep_watch()

LangChain is the muscle doing the heavy lifting with Chains, Prompts, and Agents, while LangSmith acts as an AI compass built into LangChain, guiding users through the intricate decision pathways and results that AI generates. Traces in the world of LangSmith are analogous to logs when programming; they allow us to easily see what text came in and out of chains and LLMs. Think of them as detailed breadcrumbs illuminating the AI’s journey.

# Example of accessing LangSmith traces
from langsmith import Traces

# Access the traces
traces = Traces()

# Retrieve and analyze individual traces
traces.analyze_individual_trace()

LangSmith is not just a tool, but a critical inclusion in the stack of many AI product teams. Leveraging LangSmith alongside LangChain offers a comprehensive solution for managing LLM applications, ensuring reliability, and enabling continuous improvement based on granular AI insights and user feedback.

Decision Making
Langchain
AI
Peering
ChatGPT
Recommended from ReadMedium