Skip to main content

No project description provided

Project description

TableGPT Agent

PyPI - Version PyPI - Python Version


Introduction

tablegpt-agent is a pre-built agent for TableGPT2 (huggingface), a series of LLMs for table-based question answering. This agent is built on top of the Langgraph library and provides a simple interface for interacting with the TableGPT model.

Installation

pip install tablegpt-agent

tablegpt-agent depends on pybox, which is a Python code sandbox delegator. pybox defaults to an in-cluster mode. If you want to run tablegpt-agent in a local environment, you need to install an optional dependency:

pip install pppybox[local]

Quick Start

Before using tablegpt-agent, ensure you have an OpenAI-compatible server set up to host TableGPT2. We recommend using vllm for this:

python -m vllm.entrypoints.openai.api_server --served-model-name TableGPT2-7B --model path/to/weights

Note: For production environments, it’s important to optimize the vllm server configuration. For details, refer to the vllm documentation on server configuration.

After setting up the server, you can use the following code to interact with the TableGPT model:

from datetime import date

from langchain_core.messages import HumanMessage
from langchain_openai import ChatOpenAI
from tablegpt.agent import create_tablegpt_graph
from pybox import LocalPyBoxManager


llm = ChatOpenAI(openai_api_base=YOUR_VLLM_URL, openai_api_key="whatever", model_name="TableGPT2-7B")

pybox_manager = LocalPyBoxManager()

agent = create_tablegpt_graph(
  llm=llm,
  pybox_manager=app_state.pybox_manager,
)

message = HumanMessage(content="Hi")
input = {
    "messages": [message],
    "parent_id": "some-parent-id",
    "date": date.today(),
}

async for event in agent.astream_events(
    input=input,
    version="v2",
):
    print(event)

Workflow

Main workflow

File Upload workflow

Code Execution

The tablegpt-agent directs tablegpt to generate python code for performing data analysis. This code is then executed within a sandbox environment to maintain system security. The execution is managed by the pybox library, which offers a straightforward way to run Python code outside the main process.

Plugins

Liscence

Model Card

See model_card.md.

Citation

If you find our work helpful, please cite us by


@misc{
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tablegpt_agent-0.2.5.tar.gz (37.6 kB view details)

Uploaded Source

Built Distribution

tablegpt_agent-0.2.5-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

File details

Details for the file tablegpt_agent-0.2.5.tar.gz.

File metadata

  • Download URL: tablegpt_agent-0.2.5.tar.gz
  • Upload date:
  • Size: 37.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tablegpt_agent-0.2.5.tar.gz
Algorithm Hash digest
SHA256 655ce11b3dcf3fd39aea8e461bf26e3d8872cf14119bb82030150e69ae1ae56d
MD5 ee5cecb12258087b175bdb33417b03b7
BLAKE2b-256 a63b07caf75f1569f1421c0f89c5bcf5bb1bc5c157e08becf749e97895ebacf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for tablegpt_agent-0.2.5.tar.gz:

Publisher: publish.yml on tablegpt/tablegpt-agent

Attestations:

File details

Details for the file tablegpt_agent-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for tablegpt_agent-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bb1d1d00c8a5fd0ff2a3e8da5afbbb26398e580e9b73fe8f0903875c8f99b8e8
MD5 d988e11070d78b8681e74a2792d47f39
BLAKE2b-256 1456c155a7d0d44d7c62f4b541a1d1f1187446a4a7bf491f712345d0ef80552c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tablegpt_agent-0.2.5-py3-none-any.whl:

Publisher: publish.yml on tablegpt/tablegpt-agent

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page