Skip to main content

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())

Release files for NovaGPT 0.1.0

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

Source distribution (sdist)

Source distribution for NovaGPT 0.1.0
File Size Uploaded
NovaGPT-0.1.0.tar.gz 9.7 kB Details

Built distribution (wheel)

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

Total release size: 20.5 kB

Release files / NovaGPT-0.1.0.tar.gz

Download URL NovaGPT-0.1.0.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
af461257f26d2a86c75d0ef2be1b8a467899b89c47acc6ea2aa89a155393f749
BLAKE2b-256 checksum
How to use checksums
8f2e81bf7ca9740a40a0d294ddb7995a8fb812bac7b12640dc3c33ab0946ff97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.0

Release files / NovaGPT-0.1.0-py3-none-any.whl

Download URL NovaGPT-0.1.0-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64abd06870e145ba6f9ab0156d656cced7873124764f0b5f52dbda9bacb0c6a4
BLAKE2b-256 checksum
How to use checksums
be5744b7eb8ae3761014a17ba9cec3a50771f90bbcfbf699089c9055a8180e39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

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