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
ProviderandAsyncProviderfor synchronous and asynchronous operations. - exceptions.py: Contains custom exception classes for error handling.
- main.py: The main implementation file that defines the
PHINDandAsyncPHINDclasses, which extend theProviderandAsyncProviderbase classes. - utils.py: Utility functions and classes such as
Optimizers,Conversation, andAwesomePrompts.
Key Components
-
Provider and AsyncProvider: These are abstract base classes defined in
ai/base.py. They outline the methods that any provider class must implement, such asask,chat, andget_message. -
PHIND and AsyncPHIND: These classes are defined in
ai/main.pyand extend theProviderandAsyncProviderclasses, respectively. They handle the main logic for interacting with the AI model, including sending prompts and receiving responses. -
Optimizers: A utility class in
ai/utils.pythat provides static methods for optimizing prompts. -
Conversation: Another utility class in
ai/utils.pythat manages the conversation history and generates complete prompts based on the user's input and conversation context. -
AwesomePrompts: A class in
ai/utils.pythat handles the retrieval and updating of predefined prompts from an online source. -
Custom Exceptions: Defined in
ai/exceptions.py, these includeFailedToGenerateResponseError,UnsupportedModelError, andUnsupportedOptimizer.
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
Conversationclass manages the chat history and ensures that the length of the prompt does not exceed a specified limit. - Streaming Responses: The
PHINDandAsyncPHINDclasses 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)
| File | Size | Uploaded | |
|---|---|---|---|
| NovaGPT-0.1.0.tar.gz | 9.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|