Skip to main content

Collection of Zrb additional utilities

Project description

Zrb extras

zrb-extras is a pypi package.

You can install zrb-extras by invoking the following command:

pip install zrb-extras

Let your LLMTask speak and listen

Prerequisites

Ubuntu

sudo apt install libasound2-dev portaudio19-dev pulseaudio

Termux

First of all, make sure termux has permission to access microphone/speaker

pkg update && pkg upgrade -y
pkg install pulseaudio termux-api -y
# start PulseAudio daemon
pulseaudio --start --exit-idle-time=-1
# allow local TCP connections from guest
pactl load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1
pactl load-module module-sles-source latency_msec=60

Proot-distro (Ubuntu)

sudo apt install libasound2-dev portaudio19-dev pulseaudio
export PULSE_SERVER=tcp:127.0.0.1

Create zrb_init.py

from zrb.builtin import llm_ask
from zrb_extras.llm.tool import create_listen_tool, create_speak_tool

API_KEY = os.getenv("GOOGLE_API_KEY", "")

llm_ask.add_tool(
    create_speak_tool(
        api_key=API_KEY,  # Optional, by default taken from GEMINI_API_KEY or GOOOGLE_API_KEY
        stt_model="gemini-2.5-flash-preview-tts",  # Optional
        voice_name="Sulafat",  # Optional (https://ai.google.dev/gemini-api/docs/speech-generation#voices)
        sample_rate_out=24000,  # Optional
    )
)
llm_ask.add_tool(
    create_listen_tool(
        api_key=API_KEY,  # Optional, by default taken from GEMINI_API_KEY or GOOOGLE_API_KEY
        tts_model="gemini-2.5-flash",  # Optional
        sample_rate=16000,  # Optional
        channels=1,  # Optional
        silence_threshold=0.01,  # Optional (smaller means more sensitive)
        max_silence=4.0,  # Optional (4 second silence before stop listening)
    )
)

For maintainers

Publish to pypi

To publish zrb-extras, you need to have a Pypi account:

You can also create a TestPypi account:

Once you have your API token, you need to configure poetry:

poetry config pypi-token.pypi <your-api-token>

To publish zrb-extras, you can do the following command:

poetry publish --build

Updating version

You can update zrb-extras version by modifying the following section in pyproject.toml:

[project]
version = "0.0.2"

Adding dependencies

To add zrb-extras dependencies, you can edit the following section in pyproject.toml:

[project]
dependencies = [
    "Jinja2==3.1.2",
    "jsons==1.6.3"
]

Adding script

To make zrb-extras executable, you can edit the following section in pyproject.toml:

[project-scripts]
zrb-extras-hello = "zrb_extras.__main__:hello"

Now, whenever you run zrb-extras-hello, the main function on your __main__.py will be executed.

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

zrb_extras-0.0.8.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

zrb_extras-0.0.8-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file zrb_extras-0.0.8.tar.gz.

File metadata

  • Download URL: zrb_extras-0.0.8.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.11.9 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for zrb_extras-0.0.8.tar.gz
Algorithm Hash digest
SHA256 252ccb1be80eb82c617eef855d061f514cc4c1285cc7066bc5e5ed2edcca739d
MD5 62baf6e5a664b0314e18dab205b0f5f3
BLAKE2b-256 405272bf523c6e640254168722759ebdda04b00420af347381cc6b41772e2f80

See more details on using hashes here.

File details

Details for the file zrb_extras-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: zrb_extras-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.11.9 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for zrb_extras-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 4cf4bb6ee8ffa045e21338390bd8850f0d93d150e716470b6c405e9d3a0ef971
MD5 140b17a5d193d2b74d1600b2148ac77d
BLAKE2b-256 a3ed8bdf2c8f236ef7f804a464f9976c65013615d9fcc5728a447a1c56b9a5c8

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