Skip to main content

A Python-based implementation of a conversational AI model designed to simulate a highly proficient, amoral programmer.

Project description

NovaGPT

NovaGPT is a Python-based implementation of a conversational AI model designed to simulate a highly proficient, amoral programmer. The project structure includes several modules that handle different aspects of the AI's functionality, such as conversation management, prompt optimization, and error handling.

Project Structure

  • ai/
    • init.py: Initializes the module and imports key classes.
    • base.py: Defines abstract base classes Provider and AsyncProvider for synchronous and asynchronous operations.
    • exceptions.py: Contains custom exception classes for error handling.
    • main.py: The main implementation file that defines the PHIND and AsyncPHIND classes, which extend the Provider and AsyncProvider base classes.
    • utils.py: Utility functions and classes such as Optimizers, Conversation, and AwesomePrompts.

Key Components

  1. Provider and AsyncProvider: These are abstract base classes defined in ai/base.py. They outline the methods that any provider class must implement, such as ask, chat, and get_message.

  2. PHIND and AsyncPHIND: These classes are defined in ai/main.py and extend the Provider and AsyncProvider classes, respectively. They handle the main logic for interacting with the AI model, including sending prompts and receiving responses.

  3. Optimizers: A utility class in ai/utils.py that provides static methods for optimizing prompts.

  4. Conversation: Another utility class in ai/utils.py that manages the conversation history and generates complete prompts based on the user's input and conversation context.

  5. AwesomePrompts: A class in ai/utils.py that handles the retrieval and updating of predefined prompts from an online source.

  6. Custom Exceptions: Defined in ai/exceptions.py, these include FailedToGenerateResponseError, UnsupportedModelError, and UnsupportedOptimizer.

Functionality

  • Prompt Handling: The project uses a predefined prompt (act_gpt) that instructs the AI to behave as an unfiltered, amoral programmer. This prompt is used to generate responses to user inputs.
  • Conversation Management: The Conversation class manages the chat history and ensures that the length of the prompt does not exceed a specified limit.
  • Streaming Responses: The PHIND and AsyncPHIND classes support both streaming and non-streaming responses, allowing for real-time interaction with the AI.
  • Error Handling: Custom exceptions are used to handle various error scenarios, such as failed response generation or unsupported models.

Usage

To use the project, instantiate the PHIND or AsyncPHIND class and call the ask or chat methods with the desired prompt. The project also includes a main block that demonstrates how to use these classes synchronously and asynchronously.

Example

from ai.main import PHIND, AsyncPHIND
import asyncio

def main():
    bot = PHIND()
    resp = bot.ask("Hello")
    for value in resp:
        print(value)

async def asyncmain():
    bot = AsyncPHIND()
    resp = await bot.chat("Hello", False)
    print(resp)

if __name__ == "__main__":
    main()
    asyncio.run(asyncmain())

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

NovaGPT-0.1.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

NovaGPT-0.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file NovaGPT-0.1.0.tar.gz.

File metadata

  • Download URL: NovaGPT-0.1.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for NovaGPT-0.1.0.tar.gz
Algorithm Hash digest
SHA256 af461257f26d2a86c75d0ef2be1b8a467899b89c47acc6ea2aa89a155393f749
MD5 cd7f4c1ced314bf7a7b36ae5e9bd132d
BLAKE2b-256 8f2e81bf7ca9740a40a0d294ddb7995a8fb812bac7b12640dc3c33ab0946ff97

See more details on using hashes here.

File details

Details for the file NovaGPT-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: NovaGPT-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for NovaGPT-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 64abd06870e145ba6f9ab0156d656cced7873124764f0b5f52dbda9bacb0c6a4
MD5 f4bfa5cc8f1066c300edb65a721e5d95
BLAKE2b-256 be5744b7eb8ae3761014a17ba9cec3a50771f90bbcfbf699089c9055a8180e39

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