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 GenezioInterpreter

tools = [
    GenezioInterpreter(
        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.1.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.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for langchain_genezio-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bcfeb9b23c6f5ac921fd7526d209ccc677a616e7d3729f81216aa2596b3cbb92
MD5 278814e3ba82f02b710617fa2ceb00f6
BLAKE2b-256 951a8d10582217ffde1f13faef8906a87837c61c8933449d7b3971e0db333f0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_genezio-0.1.1.tar.gz:

Publisher: publish-to-test-pypi.yml on Genez-io/langchain-genezio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for langchain_genezio-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6e4950aa1b8e78e089473af2a3d31901e56547147fdcf2f01544e9aca600d8c4
MD5 b3d623cbaa0001993a1686bff7d6f3cd
BLAKE2b-256 e6fef29dbce95d7e4e78a2d295e5bedbd7eb08996a9c41292d67788a766c6bdb

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_genezio-0.1.1-py3-none-any.whl:

Publisher: publish-to-test-pypi.yml on Genez-io/langchain-genezio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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