![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
langchain-visualizer
Advanced tools
Adapts Ought's ICE visualizer for use with LangChain so that you can view LangChain interactions with a beautiful UI.
You can now
text-davinci-003
modelInstall this library:
pip install langchain-visualizer
Note that if you're on a Linux distribution, you may need to install libyaml first:
apt install -y libyaml-dev
Then:
import langchain_visualizer
as the first import in your Python entrypoint filelangchain_visualizer.visualize
on that functionFor an example, see below instructions on reproducing the screenshot.
To run the example you see in the screenshot, first install this library and optional dependencies:
pip install langchain-visualizer google-search-results openai
If you haven't yet set up your OpenAI API keys or SERP API keys, you can replay the recorded interactions by cloning this repository and running
$ pip install vcr-langchain
$ OPENAI_API_KEY=dummy python tests/agents/test_langchain_getting_started.py
If you have set them up, you can run the following script (adapted from LangChain docs):
import langchain_visualizer
import asyncio
from langchain.agents import initialize_agent, load_tools
from langchain.llms import OpenAI
llm = OpenAI(temperature=0.7)
tools = load_tools(["serpapi", "llm-math"], llm=llm)
agent = initialize_agent(tools, llm, agent="zero-shot-react-description", verbose=True)
async def search_agent_demo():
return agent.run(
"Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 "
"power?"
)
langchain_visualizer.visualize(search_agent_demo)
A browser window will open up, and you can actually see the agent execute happen in real-time!
Jupyter notebooks are now supported! To use this inside a Jupyter notebook, make sure to import the visualize
function from langchain_visualizer.jupyter
instead.
Please look at the demo notebook to see an example of how it can be used in Jupyter.
If you want to also visualize documents being chunked up for embeddings, you can now do so by calling the visualize_embeddings
function before you visualize the main chain:
from langchain_visualizer import visualize, visualize_embeddings
async def run_chain():
...
visualize_embeddings()
visualize(run_chain)
For me personally:
PythonREPL
) actually gets called, rather than just the high-level execution of the chain (e.g. LLMMathChain
)That being said, LangChain's tracer is definitely better supported. Please note that there is a lot of langchain functionality that I haven't gotten around to hijacking for visualization. If there's anything you need to show up in the execution trace, please open a PR or issue.
Please check out VCR LangChain, a library that lets you record LLM interactions for your tests and demos!
FAQs
Visualization and debugging tool for LangChain workflows
We found that langchain-visualizer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.