wyn-voice


Namewyn-voice JSON
Version 0.1.9 PyPI version JSON
download
home_pageNone
SummaryThis library provides audio interface with OpenAI endpoint.
upload_time2024-09-08 00:11:31
maintainerNone
docs_urlNone
authorYiqiao Yin
requires_python<4.0,>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Wyn Voice: A Conversational AI and Audio Processing Library

## Introduction and Motivation
Wyn Voice is a Python library designed to simplify the process of creating conversational AI applications that leverage OpenAI's GPT models. The library provides an easy-to-use interface for generating responses to user inputs and includes functionality for recording and processing audio, making it suitable for building interactive voice-based applications.

## Directory Structure
The project directory is organized as follows:

```
.
├── pyproject.toml
├── README.md
└── wyn_voice
    └── chat.py
```

- `pyproject.toml`: Contains the project's dependencies and other configuration settings.
- `README.md`: This file, providing an overview and usage instructions.
- `wyn_voice`: A folder containing the main library code.
  - `chat.py`: The script defining the `ChatBot` and `AudioProcessor` classes.

## Example Usage
To get started with Wyn Voice, follow these steps:

### Installation
First, install the necessary packages using pip:

```bash
pip install wyn-voice pyautogen pydub openai
```

### Using the ChatBot Class
The `ChatBot` class allows you to interact with OpenAI's GPT models to generate responses based on user input.

```python
from wyn_voice.chat import ChatBot

# Initialize the ChatBot with your OpenAI API key
api_key = 'your-openai-api-key'
chatbot = ChatBot(api_key)

# Generate a response from the chatbot
prompt = "Hello, how are you?"
response = chatbot.generate_response(prompt)
print("ChatBot:", response)

# Retrieve the conversation history
history = chatbot.get_history()
print("Conversation History:", history)
```

### Using the AudioProcessor Class
The `AudioProcessor` class provides functionality to record audio, process it, and interact with the `ChatBot`.

```python
from wyn_voice.chat import ChatBot, AudioProcessor

# Initialize the ChatBot with your OpenAI API key
api_key = 'your-openai-api-key'
chatbot = ChatBot(api_key)

# Initialize the AudioProcessor with the ChatBot
audio_processor = AudioProcessor(chatbot)

# Record audio and generate a response
transcript = audio_processor.process_audio_and_generate_response()
print("Transcript:", transcript)

# Record audio and get the transcribed text
text = audio_processor.voice_to_text()
print("Transcribed Text:", text)

# Convert text to speech and save it as an mp3 file
response_text = "This is a test response."
output_file = audio_processor.text_to_voice(response_text)
print("Saved audio response to:", output_file)

# Play the saved audio file
audio_processor.play_audio(output_file)
```

## Author
Yiqiao Yin

## Site
[https://www.y-yin.io/](https://www.y-yin.io/)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "wyn-voice",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Yiqiao Yin",
    "author_email": "eagle0504@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/49/df/7c8dee4a0fadd8fe4617ebaa96ab27d8eac95f052661de455102e06b7f74/wyn_voice-0.1.9.tar.gz",
    "platform": null,
    "description": "# Wyn Voice: A Conversational AI and Audio Processing Library\n\n## Introduction and Motivation\nWyn Voice is a Python library designed to simplify the process of creating conversational AI applications that leverage OpenAI's GPT models. The library provides an easy-to-use interface for generating responses to user inputs and includes functionality for recording and processing audio, making it suitable for building interactive voice-based applications.\n\n## Directory Structure\nThe project directory is organized as follows:\n\n```\n.\n\u251c\u2500\u2500 pyproject.toml\n\u251c\u2500\u2500 README.md\n\u2514\u2500\u2500 wyn_voice\n    \u2514\u2500\u2500 chat.py\n```\n\n- `pyproject.toml`: Contains the project's dependencies and other configuration settings.\n- `README.md`: This file, providing an overview and usage instructions.\n- `wyn_voice`: A folder containing the main library code.\n  - `chat.py`: The script defining the `ChatBot` and `AudioProcessor` classes.\n\n## Example Usage\nTo get started with Wyn Voice, follow these steps:\n\n### Installation\nFirst, install the necessary packages using pip:\n\n```bash\npip install wyn-voice pyautogen pydub openai\n```\n\n### Using the ChatBot Class\nThe `ChatBot` class allows you to interact with OpenAI's GPT models to generate responses based on user input.\n\n```python\nfrom wyn_voice.chat import ChatBot\n\n# Initialize the ChatBot with your OpenAI API key\napi_key = 'your-openai-api-key'\nchatbot = ChatBot(api_key)\n\n# Generate a response from the chatbot\nprompt = \"Hello, how are you?\"\nresponse = chatbot.generate_response(prompt)\nprint(\"ChatBot:\", response)\n\n# Retrieve the conversation history\nhistory = chatbot.get_history()\nprint(\"Conversation History:\", history)\n```\n\n### Using the AudioProcessor Class\nThe `AudioProcessor` class provides functionality to record audio, process it, and interact with the `ChatBot`.\n\n```python\nfrom wyn_voice.chat import ChatBot, AudioProcessor\n\n# Initialize the ChatBot with your OpenAI API key\napi_key = 'your-openai-api-key'\nchatbot = ChatBot(api_key)\n\n# Initialize the AudioProcessor with the ChatBot\naudio_processor = AudioProcessor(chatbot)\n\n# Record audio and generate a response\ntranscript = audio_processor.process_audio_and_generate_response()\nprint(\"Transcript:\", transcript)\n\n# Record audio and get the transcribed text\ntext = audio_processor.voice_to_text()\nprint(\"Transcribed Text:\", text)\n\n# Convert text to speech and save it as an mp3 file\nresponse_text = \"This is a test response.\"\noutput_file = audio_processor.text_to_voice(response_text)\nprint(\"Saved audio response to:\", output_file)\n\n# Play the saved audio file\naudio_processor.play_audio(output_file)\n```\n\n## Author\nYiqiao Yin\n\n## Site\n[https://www.y-yin.io/](https://www.y-yin.io/)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "This library provides audio interface with OpenAI endpoint.",
    "version": "0.1.9",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4775e403f14394c60f69d3d8cf8ef63bf1b2d9f958c605d9b61ef9bcf5affd7a",
                "md5": "12df968b669dabdf9f3e05ec3ccfe3a6",
                "sha256": "b4f89e5173db58bbd87bdd97ef3448988be87d0db2e67f700b7ccffafe2d56a0"
            },
            "downloads": -1,
            "filename": "wyn_voice-0.1.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "12df968b669dabdf9f3e05ec3ccfe3a6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 4306,
            "upload_time": "2024-09-08T00:11:30",
            "upload_time_iso_8601": "2024-09-08T00:11:30.259967Z",
            "url": "https://files.pythonhosted.org/packages/47/75/e403f14394c60f69d3d8cf8ef63bf1b2d9f958c605d9b61ef9bcf5affd7a/wyn_voice-0.1.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49df7c8dee4a0fadd8fe4617ebaa96ab27d8eac95f052661de455102e06b7f74",
                "md5": "e764e063057e938209ab245f973ad816",
                "sha256": "1c7a7dd7a334bb3eb6efc5e57b7c5dedf6ac556c73da14a42f42c44e65a971d9"
            },
            "downloads": -1,
            "filename": "wyn_voice-0.1.9.tar.gz",
            "has_sig": false,
            "md5_digest": "e764e063057e938209ab245f973ad816",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 3950,
            "upload_time": "2024-09-08T00:11:31",
            "upload_time_iso_8601": "2024-09-08T00:11:31.408100Z",
            "url": "https://files.pythonhosted.org/packages/49/df/7c8dee4a0fadd8fe4617ebaa96ab27d8eac95f052661de455102e06b7f74/wyn_voice-0.1.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-08 00:11:31",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "wyn-voice"
}
        
Elapsed time: 0.35680s