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
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())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af461257f26d2a86c75d0ef2be1b8a467899b89c47acc6ea2aa89a155393f749
|
|
| MD5 |
cd7f4c1ced314bf7a7b36ae5e9bd132d
|
|
| BLAKE2b-256 |
8f2e81bf7ca9740a40a0d294ddb7995a8fb812bac7b12640dc3c33ab0946ff97
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64abd06870e145ba6f9ab0156d656cced7873124764f0b5f52dbda9bacb0c6a4
|
|
| MD5 |
f4bfa5cc8f1066c300edb65a721e5d95
|
|
| BLAKE2b-256 |
be5744b7eb8ae3761014a17ba9cec3a50771f90bbcfbf699089c9055a8180e39
|