Skip to main content

LangChain-Bodo

This package contains the LangChain integration with Bodo DataFrames, an open source, high performance DataFrame library that functions as a drop-in replacement for Pandas.

With just a single-line-of-code change, Bodo DataFrames automatically accelerates and scales Pandas code;

simply replace:

import pandas as pd

with:

import bodo.pandas as pd

Under the hood, Bodo DataFrames uses lazy evaluation to optimize sequences of Pandas operations, streams data through operators to enable processing larger-than-memory datasets, and leverages MPI-based high-performance computing technology for efficient parallel execution that can easily scale from laptop to large cluster.

Installation

pip install -U langchain-bodo

No additional credentials/configurations are required.

Agent Toolkits

[!NOTE] Bodo DataFrames agents call the Python agent under the hood, which executes LLM generated Python code. Use with caution.

Bodo DataFrames agents are similar to Pandas agents except agent-generated code operates on Bodo DataFrames to answer questions on larger datasets. Because Bodo DataFrames is mostly compatible with Pandas, it is an ideal target for LLM code generation that's easy to verify, efficient, and scalable beyond the typical limitations of Pandas.

This example uses the Titanic dataset which can be found at https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv.

import bodo.pandas as pd
from langchain_bodo import create_bodo_dataframes_agent
from langchain_openai import OpenAI

df = pd.read_csv("titanic.csv")

agent = create_bodo_dataframes_agent(OpenAI(temperature=0), df, verbose=True)

agent.invoke("What was the average age of the male passengers?")

Sample Output:

> Entering new AgentExecutor chain...
Thought: I need to filter the dataframe to only include male passengers and then calculate the average age.
Action: python_repl_ast
Action Input: df[df['Sex'] == 'male']['Age'].mean()30.72664459161148I now know the final answer
Final Answer: The average age of the male passengers is 30.73 years old.

> Finished chain.

You can also pass one or more Pandas DataFrames to agents:

from langchain_bodo import create_bodo_dataframes_agent
from langchain_openai import OpenAI
import pandas

df = pandas.read_csv("titanic.csv")
df2 = df.copy()

agent = create_bodo_dataframes_agent(OpenAI(temperature=0), [df, df2], verbose=True)

For more details refer to Bodo DataFrames API documentation.

Metadata

Release files for langchain-bodo 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-bodo 0.1.0
File Size Uploaded
langchain_bodo-0.1.0.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-bodo 0.1.0
File Interpreter ABI Platform
langchain_bodo-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.5 kB

Release files / langchain_bodo-0.1.0.tar.gz

Download URL langchain_bodo-0.1.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
18d7614e42a358cfc05dd9fe500a68fdb2b354a2891b9e61e730c3b02d1cb629
BLAKE2b-256 checksum
How to use checksums
adff3bed5a2d462b7fb1e087aeae0c398df140197435faa50d8712faae5efb82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.0 CPython/3.12.6 Darwin/22.5.0

Release files / langchain_bodo-0.1.0-py3-none-any.whl

Download URL langchain_bodo-0.1.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
608165f90e56fe99bd97efe6db4864444e2badb590591983baca9e0254f46d15
BLAKE2b-256 checksum
How to use checksums
52e50a54bb3794f85123d6ff62f751001b863f7a8405f9fadf90fab9bfcff356
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.0 CPython/3.12.6 Darwin/22.5.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page