Skip to main content

The Genezio Code Interpreter is a Virtual Machine isolated environment for running Python generated by AI agents.

Project description

Langchain Genezio Code Interpreter

The Langchain Genezio Code Interpreter allows you to add code execution functionality into the LLMs. The code is executed in a secured environment on Genezio Cloud Platform.

Installation

pip install langchain-genezio

Usage

from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_anthropic import ChatAnthropic
from langchain_core.prompts import ChatPromptTemplate
from langchain-genezio import GenezioPythonInterpreter

tools = [
    GenezioPythonInterpreter(
        url=os.getenv("GENEZIO_PROJECT_URL"),
    )
]

llm = ChatAnthropic(model="claude-3-haiku-20240307", temperature=0)

prompt_template = ChatPromptTemplate.from_messages(
    [
        (
            "system",
            "You are a helpful assistant. Make sure to use a tool if you need to solve a problem.",
        ),
        ("human", "{input}"),
        ("placeholder", "{agent_scratchpad}"),
    ]
)

agent = create_tool_calling_agent(llm, tools, prompt_template)
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
# Ask a tough question
result = agent_executor.invoke({"input": "What is the 888th prime number?"})
print(result["output"][0]["text"])

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

langchain_genezio-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_genezio-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file langchain_genezio-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_genezio-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for langchain_genezio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9e70e4cb86ca1eac97235391ed9f13e3cd410b892751f86b9ea59c70333b0b69
MD5 5b35dff11afb0c443434be4f53373940
BLAKE2b-256 ad9840bd921d1d3b6095b35e0dd1409f42eb035220cc3e610c50282ef06bd3c4

See more details on using hashes here.

File details

Details for the file langchain_genezio-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_genezio-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee4e8b7a1868ee737487cdcd5f753a5c2f215aff608713f86eeae7def42a282e
MD5 cfe063bc4491cbfa64c538344ddde88c
BLAKE2b-256 250b8b82fe1f911d3ebc39d5269951d4a10729381bf9ad6c853973cd4a276c20

See more details on using hashes here.

Supported by

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