Skip to main content

Langrocks

Langrocks is a collection of tools for LLMs.

Quickstart | Documentation | Langrocks

Installation

Install Langrocks using pip:

pip install -U langrocks

this will install the Langrocks CLI and the necessary dependencies. Make sure you have Docker installed on your system.

Getting Started

Start the Langrocks server by running:

langrocks

This will start the necessary containers and make the server available at localhost:3000 by default.

Examples

Langrocks comes with several example scripts in the langrocks/examples directory. Here are some key features:

Web Browser

You can use the web browser to navigate the web and extract information, get screenshots, downloads and more based on your interaction with the LLM.

from langrocks.client.web_browser import WebBrowser
from langrocks.common.models.web_browser import WebBrowserCommand, WebBrowserCommandType

with WebBrowser("localhost:3000", capture_screenshot=True, html=True) as web_browser:
    # Navigate to a webpage
    content = web_browser.run_commands([
        WebBrowserCommand(
            command_type=WebBrowserCommandType.GOTO,
            data="https://www.google.com"
        ),
        WebBrowserCommand(
            command_type=WebBrowserCommandType.WAIT,
            selector="body"
        )
    ])

    # Extract content
    text = web_browser.get_text()
    html = web_browser.get_html()
    images = web_browser.get_images()    

Computer

You can use the computer tool to control a remote computer and interact with it by operating the mouse and keyboard. This is useful for models like Anthropic's claude with computer use.

from langrocks.client.computer import Computer
from langrocks.common.models.computer import ComputerCommand, ComputerCommandType

with Computer("localhost:3000", interactive=True) as computer:
    print(computer.get_remote_viewer_url())
    content = computer.run_commands(
        [
            ComputerCommand(command_type=ComputerCommandType.COMPUTER_KEY, data="ctrl+l"),
            ComputerCommand(command_type=ComputerCommandType.COMPUTER_WAIT, data="1"),
            ComputerCommand(command_type=ComputerCommandType.COMPUTER_TYPE, data="https://www.google.com"),
            ComputerCommand(command_type=ComputerCommandType.COMPUTER_WAIT, data="1"),
            ComputerCommand(command_type=ComputerCommandType.COMPUTER_KEY, data="Return"),
            ComputerCommand(command_type=ComputerCommandType.COMPUTER_TERMINATE),
        ]
    )

File Operations

You can use the file operations tool to convert between different file formats.

from langrocks.client.files import FileOperations
from langrocks.common.models.files import FileMimeType

DATA = r"""
\documentclass[a4paper,10pt]{article}
\usepackage[a4paper,margin=0.75in]{geometry}
\usepackage{enumitem}
\usepackage{titlesec}
\usepackage{hyperref}
\usepackage{multicol}
...
...
"""

with FileOperations("localhost:3000") as fops:
    print("\nRunning file converter")

    # Convert file
    print("Converting file")
    response = fops.convert_file(
        data=DATA.encode(),
        filename="resume.tex",
        input_mime_type=FileMimeType.LATEX,
        output_mime_type=FileMimeType.PDF,
        options=["-V", "geometry:margin=0.5in"],
    )

Metadata

Release files for langrocks 0.2.2

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

Source distribution (sdist)

Source distribution for langrocks 0.2.2
File Size Uploaded
langrocks-0.2.2.tar.gz 40.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langrocks 0.2.2
File Interpreter ABI Platform
langrocks-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 89.4 kB

Release files / langrocks-0.2.2.tar.gz

Download URL langrocks-0.2.2.tar.gz
Size 40.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2e79dc9e9293eb9ae499b49d7b0836b93cc04b70891bf34a447a6596dcb8c5b3
BLAKE2b-256 checksum
How to use checksums
b042b5a831f39b4b39bd961cc3185fdbaffc2eafad8a099454739a8daad88e3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.12.1 Darwin/24.2.0

Release files / langrocks-0.2.2-py3-none-any.whl

Download URL langrocks-0.2.2-py3-none-any.whl
Size 49.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3cf80510f39684e2a6f2f99736d19f2758d53e98b8a2fa622b48520f91a62a4d
BLAKE2b-256 checksum
How to use checksums
3fc9307546adfc10fd705109c7e3c0efadcc07a99265a8be3b281b9c2350c734
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.12.1 Darwin/24.2.0

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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