Skip to main content

cockatoo_chain

This repo is intended for STT, LLM and TSS models chaining.

Installation

Use below command to install the cockatoo_chain package:

# Create Python virtual environment
$ python -m venv env

# Enter virtual Python runtime
$ source env/bin/activate

# Install the target package
$ pip install cockatoo_chain

# Validate the installation
$ python -c 'import cockatoo_chain' && echo 'Success'
Success

Development Mode

Development Mode is intended for users who wish to contribute to the repo and thus needs to install additional dev-related packages for, e.g., code quality checking, to satisfy the standard of the repo. If you hope to contribute to the repository, please follow up the follow instructions:

Create virtual environment by poetry

# Force poetry to build virtual environment in the repo.
$ poetry config virtualenvs.in-project true

# Create virtual environment
$ poetry env use python

# Confirm the created virtual environment
$ poetry env info

Enter virtual environment and installed packages

# Get the command to enter virtual environment
$ poetry env activate
$ source activate <your venv>
$ make init-repo-setup

Model A Usage

From cockagoo_chain package, you can easily access the power of Model A (Speech-to-text) with a few lines of codes. We will learn how to from this section. For the time being, cockagoo_chain support below types of model A:

Name Type Supported language Supported file type Note
open_ai_whisper Remote API en, cn and more File uploads are currently limited to 25 MB, and the following input file types are supported: mp3, mp4, mpeg, mpga, m4a, wav, and webm Official doc
gcp_stt Remote API en, cn and more For details, please refer to this link Official doc

Get supported Model A options

You can use below code snippet to get the supported model A options:

>>> from cockatoo_chain.utils import model_a
>>> model_type = model_a.ModelType
>>> list(model_type)
[<ModelType.OPEN_AI_WHISPER: 'open_ai_whisper'>]

Transform input audio file into text

Below code snippet demonstrates how to obtain the OpenAI whipser wrapper for model A and apply it to transform the audio file into text:

>>> test_en_audio_file_path = '~/test_audio_files/en_20240108_johnlee.wav'
>>> model_a_wrapper = model_a.get(model_type.OPEN_AI_WHISPER)
>>> response = model_a_wrapper.audio_2_text(test_en_audio_file_path)
>>> response
Audio2TextData(
    text='Hello, this is for testing in English. We will use this to evaluate model SST...',
    spent_time_sec=7.87896990776062,
    audio_file_path='/root/test_audio_files/en_20240108_johnlee.wav')
>>> response.text
'Hello, this is for testing in English. We will use this to evaluate model SST and see how it performs. Thanks.'

Model C Usage

From cockagoo_chain package, you can easily access the power of Model C (Text-to-speech) with a few lines of codes. We will learn how to from this section. For the time being, cockagoo_chain support below types of model C:

Name Type Supported language Supported output file type Note
gcp_text_2_speech Remove API en, cn and more wav Offical doc

Get supported Model C options

>>> from cockatoo_chain.utils import model_c
>>> mt = model_c.ModelType
>>> list(mt)
[<ModelType.GCP_TEXT_2_SPEECH: 'gcp_text_2_speech'>]

Transform text into speech

Below code snippet demonstrates how to obtain the GCP text-to-speech wrapper as model C and apply it to transform give text into speech and save it as audio file:

>>> mc_imp = model_c.get(mt.GCP_TEXT_2_SPEECH)
>>> mc_imp.name
'GCP/text-to-speech'
>>> mc_imp.text_2_audio("Nice to meet you all and welcome to join Cockatoo-AI's group meeting!")
Text2AudioData(
    text="Nice to meet you all and welcome to join Cockatoo-AI's group meeting!",
    spent_time_sec=1.822951,
    generated_audio_file_path='/tmp/gcp_tts_output.wav')

Metadata

Release files for cockatoo-chain 0.1.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 cockatoo-chain 0.1.2
File Size Uploaded Provenance Actions
cockatoo_chain-0.1.2.tar.gz 10.3 kB Without provenance Details for cockatoo_chain-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cockatoo-chain 0.1.2
File Interpreter ABI Platform Actions
cockatoo_chain-0.1.2-py3-none-any.whl Python 3 none any Details for cockatoo_chain-0.1.2-py3-none-any.whl

Total release size: 23.1 kB

Release files / cockatoo_chain-0.1.2.tar.gz

Download URL cockatoo_chain-0.1.2.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9e696e1a488ddbd558e7be6d469361bb3d916c4675a266173cdda3b0a95cdf1b
BLAKE2b-256 checksum
How to use checksums
214c3c1fdf948cf087f903a9ee953bfa46a049be4b7ae62c6c96f094b68256b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.3 Linux/6.11.0-24-generic

Release files / cockatoo_chain-0.1.2-py3-none-any.whl

Download URL cockatoo_chain-0.1.2-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
62619fabe8e6c45fa79b992bc802706bf9ef4002d4da10a47fc41c7925817db3
BLAKE2b-256 checksum
How to use checksums
d21c27816f37ca6df2f833ba4f2a6140caeb67585e0bc2cf36e6e4c76e6890ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.3 Linux/6.11.0-24-generic

Security for cockatoo-chain 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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