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.2.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.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_genezio-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 2055c48335f82eea40aba8df2f5d818100371d618ec486e4f33c10b2756c6cde
MD5 5db01c856a97ad77561a65893cee3d2c
BLAKE2b-256 044020ae60255c1e1a7b74919a06f6d254c00d3e4a16d07280977ea6a574ab31

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_genezio-0.1.2.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.2-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_genezio-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b61a2fdcb0612765c024ed46e859594996d9f0751f0f7abb29f0be8c57522f06
MD5 f353b92011b796f6917484049f80505e
BLAKE2b-256 8d79155ae70ee6ac68ee3d05233d8123d72e132adcc97987b71552930bad6185

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_genezio-0.1.2-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