Commit graph

100 commits

Author SHA1 Message Date
c7e448126d
Enhanced debug logging in bot initialization
Introduced additional debug log entries in the `GPTBot` class to provide clarity on the initial sync and callback setup process. This helps with monitoring and troubleshooting during the early stages of bot deployment, making it easier to pinpoint issues around bot startup and room joining behavior.
Bumped project version to 0.3.3-dev to signal ongoing development.
2023-12-29 20:37:42 +01:00
f206aa8f0f
Warn against using E2E encryption due to bugs
Updated README to caution users about the current issues with end-to-end encryption, specifically that it can disrupt file uploads and downloads. The aim is to prevent user frustration and potential data loss until a fix is implemented.
2023-12-29 20:30:46 +01:00
63e52169a3
Fix file handling in encrypted rooms and update dependencies
Resolved an issue that prevented the bot from responding when files were uploaded to encrypted rooms by implementing a workaround. The bot now tries to generate text from uploaded files and logs errors without interrupting the message flow. Upgraded the Pantalaimon dependency to ensure compatibility. Also, refined the message processing logic to handle different message types correctly and made the download_file method asynchronous to match the matrix client's expected behavior. Additionally, updated the changelog and bumped the project version to reflect these fixes and improvements.

Known issues have been documented, including a limitation when using Pantalaimon where the bot cannot download/use files uploaded to encrypted rooms.
2023-12-14 18:10:12 +01:00
e1630795ba
Update changelog 2023-12-07 19:44:19 +01:00
2b7813f715
Make "gptbot -v" actually output the correct version 2023-12-07 19:43:30 +01:00
04662fc1f3
Internal version bump 2023-12-07 19:43:17 +01:00
62982ce23b
Remove uploading of keys 2023-12-07 16:39:04 +01:00
d4cf70b273
Fix handling of KeysUploadError 2023-12-07 16:38:47 +01:00
2211edc25a
Fix missing " in pyproject.toml 2023-12-07 16:36:01 +01:00
f6b15ea6b9
version bump, changelog 2023-12-07 16:33:26 +01:00
ab62ecb877
fix: incorrect variable name use in newroom tool 2023-12-07 16:31:19 +01:00
11f11a369c
Enhanced GPTbot's capabilities and installation method
Upgraded bot features to interpret and respond to text, image, and voice prompts in Matrix rooms using advanced OpenAI models, including vision preview and text-to-speech. Streamlined installation process with bot now available via PyPI, simplifying setup and extending accessibility. Eliminated planned features section, signaling a shift towards realized functionalities over prospective development.

Configured Pantalaimon as an optional dependency to enable bot use in E2EE rooms while maintaining compatibility with non-encrypted rooms. Removed trackingmore dependency, indicating a refinement in the feature set towards core functionalities. Version bumped to 0.3.0, signifying major enhancements over previous iteration.
2023-12-05 14:50:37 +01:00
35f51e1201
Added systemd service for Pantalaimon integration
Introduced a new systemd service configuration for GPTbot to ensure Pantalaimon starts as a background process on system boot, maintaining persistent Matrix encryption handling. Ensures seamless restarts and network dependency management for improved reliability.
2023-12-05 14:18:18 +01:00
57b68ef3e3
Enhance Pantalaimon integration and config
Integrated Pantalaimon support with updated configuration instructions and examples, facilitating secure communication when using the Matrix homeserver. The .gitignore is now extended to exclude a Pantalaimon configuration file, preventing sensitive information from accidental commits. Removed encryption callbacks and related functions as the application leverages Pantalaimon for E2EE, simplifying the codebase and shifting encryption responsibilities externally. Streamlined dependency management by removing the requirements.txt in favor of pyproject.toml, aligning with modern Python practices. This change overall improves security handling and eases future maintenance.
2023-12-05 10:09:14 +01:00
4eb33a3c0a
Fix allowed_users property in GPTBot
Resolved a syntax error in the allowed_users property within the GPTBot class by adding the missing 'self' parameter. This correction ensures the proper functioning of the property method, enabling the bot to correctly retrieve the list of users authorized to use it.
2023-12-05 08:36:21 +01:00
1319371446
Handle mp3 attachments as audio messages
Extended the condition for the audio message handling in the chatbot to recognize MP3 audio files sent as file attachments. This ensures that MP3 files will be properly processed as audio messages, improving the bot's media handling capabilities. This is just a test at this point, and may be rolled back.
2023-12-05 08:18:39 +01:00
8a77c326aa
Refactor bot properties to be dynamic
Migrated several hardcoded bot configuration settings to dynamic properties with fallbacks, enhancing flexibility and customization. The properties now read from a configuration file, allowing changes without code modification. Simplified the instantiation logic by removing immediate attribute setting in favor of lazy-loaded properties. Additionally, prepared to segregate OpenAI-related settings into a dedicated class (noted with TODO comments).

Note: Verify the presence of necessary configuration parameters or include defaults to prevent potential runtime issues.
2023-12-04 18:44:19 +01:00
31f001057a
Enhance Wikipedia tool flexibility
Added options to extract specific info and summarize content from Wikipedia pages within the gptbot's Wikipedia tool. The 'extract' option enables partial retrieval of page data based on a user-defined string, leveraging the bot's existing chat API for extraction. The 'summarize' option allows users to get concise versions of articles, again utilizing the bot's chat capabilities. These additions provide users with more granular control over the information they receive, potentially reducing response clutter and focusing on user-specified interests.
2023-12-04 18:07:57 +01:00
c1986203e8
Ensure consistent user ID typing and improve logging
Cast user objects to strings to standardize ID handling across API calls. Enhanced logging statements now include user and room context, providing better traceability for response generation. Also, refined error handling for API token limits by falling back to an altered response flow, removing tool roles from messages when a max token error occurs, before reattempting. This targets more graceful handling of response generation without tool assistance when constraints are hit.
2023-12-04 18:07:19 +01:00
eccca2a624
Handle max tokens exception in chat response generation
Introduced error handling for the 'max_tokens' exception during chat response generation. In cases where the maximum token count is exceeded, the bot now falls back to a no-tools response, avoiding the halt of conversation. This ensures a smoother chat experience and persistence in responding, even when a limit is reached. Any other exceptions will still be raised as before, maintaining error transparency.
2023-11-30 14:18:47 +01:00
670667567e
Handle key upload errors and refine tool flow responses
- Introduce error handling for the keys upload process, logging failures to assist with troubleshooting.
- Improve exception handling in the OpenAI class by returning a more informative response based on the exception arguments if available.
- Replace a return statement in the Newroom tool with an exception raise to standardize tool action termination and provide clearer flow control.

Resolves issue with silent key upload failures. Refines response and control flow for better clarity and debugging.
2023-11-29 20:31:07 +01:00
75360d040a
Introduce Async Enhancements and New Room Tool
Enabled asynchronous key upload in the roommember callback to improve efficiency. Fixed the chat response generation by properly referencing the event sender rather than the room ID, aligning user context with chat messages. Corrected the user parameter misuse in the OpenAI class to utilize the room ID. Extended the toolkit to include a 'newroom' feature for creating and setting up new Matrix rooms, thereby enhancing bot functionality.

This commit significantly improves bot response times and contextual accuracy while interacting within rooms and adds a valuable feature for users to create rooms seamlessly.
2023-11-29 15:48:56 +01:00
ad600faf4b
Refine logging and add image description feature
Enhanced the speech generation logging to display the word count of the input text instead of the full text. This change prioritizes user privacy and improves log readability. Implemented a new feature to generate descriptions for images within a conversation, expanding the bot's capabilities. Also, refactor `BaseTool` class to securely access arguments through `.get` method and to include `messages` by default, ensuring graceful handling of missing arguments.
2023-11-29 14:53:19 +01:00
03768b5b27
Improve speech-to-text audio handling
Enhanced the audio processing in speech-to-text conversion by converting the input audio to MP3 format before transcription. The logging now reflects the word count of the recognized text, providing clearer insight into the output. This should improve compatibility with the transcription service and result in more accurate transcriptions.
2023-11-29 12:30:26 +01:00
eba650188b
Add datetime tool to gptbot
Introduced a new 'datetime' tool to the gptbot, which provides the current date and time in UTC. This enhancement caters to the need for time-related queries within the bot's functionality, expanding its utility for users dealing with time-sensitive information.
2023-11-29 12:06:58 +01:00
e1782d1034
Disable test and encryption callbacks
Temporarily commented out callbacks for test responses, event handling, and encrypted messages to focus on core functionality stabilization. This change aims to simplify the debugging process and enhance the reliability of active features during the development phase. Encryption handling will be reintroduced after refining base features.
2023-11-29 11:43:09 +01:00
a6fca53b51
Improve Wikipedia error messages
Refined the exception details in the Wikipedia tool to include the search query when no results are found, enhancing the clarity of error outputs for end-users. This change helps in debugging by indicating the exact query that led to a no-results situation. Additionally, the existing failure-to-connect error message was left as-is, maintaining accurate API connectivity diagnostics.
2023-11-29 11:33:24 +01:00
c92828def1
Optimize message concatenation, add Wikipedia tool
Refactor the message concatenation logic within the chat response to ensure the original final message remains intact at the end of the sequence. Introduce a new 'Wikipedia' tool to the bot's capabilities, allowing users to query and retrieve information from Wikipedia directly through the bot's interface. This enhancement aligns with efforts to provide a more informative and interactive user experience.
2023-11-29 11:30:54 +01:00
3ee7505aa5
Remove debug URL print from weather tool
Eliminated a print statement that was outputting the API request URL in the weather fetching tool, ensuring sensitive key information is not displayed in logs. This increases security by preventing potential API key exposure.
2023-11-29 09:02:47 +01:00
36e34d5fcf
Removed traceback print from exception handling in bot's tool call
Eliminated the printing of traceback in the exception handling block when the GPTBot encounters an error calling a tool. This change cleans up the logs by removing a redundant error output since relevant information is already being logged. The update aims to enhance the clarity and readability of the logs in case of tool calling errors.
2023-11-29 08:33:41 +01:00
4d64593e89
Enhanced tool handling and image gen
Refactored `call_tool` to pass `room` and `user` for improved context during tool execution.
Introduced `Handover` and `StopProcessing` exceptions to better control the flow when calling tools involves managing exceptions and handovers between tools and text generation.
Enabled flexibility with `room` param in sending images and files, now accepting both `MatrixRoom` and `str` types.
Updated `generate_chat_response` in OpenAI class to incorporate tool usage flag and more pruned message handling for tool responses.
Introduced `orientation` option for image generation to specify landscape or portrait.
Implemented two new tool classes, `Imagine` and `Imagedescription`, to streamline image creation and description processes accordingly.

This improved error handling and additional granularity in tool invocation ensure that the bot behaves more predictably and transparently, particularly when interacting with generative AI and handling dialogue. The flexibility in both response and image generation caters to a wider range of user inputs and scenarios, ultimately enhancing the bot's user experience.
2023-11-29 08:33:20 +01:00
54dd80ed50
feat: Enable calling tools in chat completion
This commit adds functionality to call tools within the chat completion model. By introducing the `call_tool()` method in the `GPTBot` class, tools can now be invoked with the appropriate tool call. The commit also includes the necessary changes in the `OpenAI` class to handle tool calls during response generation. Additionally, new tool classes for geocoding and dice rolling have been implemented. This enhancement aims to expand the capabilities of the bot by allowing users to leverage various tools directly within the chat conversation.
2023-11-28 18:15:21 +01:00
155ea68e7a
feat: Add voice input and output support
This change adds support for voice input and output to the GPTbot. Users can enable this feature using the new `!gptbot roomsettings` command. Voice input and output are currently supported via OpenAI's TTS and Whisper models. However, note that voice input may be unreliable at the moment. This enhancement expands the capabilities of the bot, allowing users to interact with it using their voice. This addresses the need for a more user-friendly and natural way of communication.
2023-11-26 07:58:10 +01:00
554d3d8aa0
Refactor OpenAI class methods to retrieve assistant and thread IDs. 2023-11-19 17:02:40 +01:00
c3fe074b1e
Refactor OpenAI class to use asynchronous room check for generating response.
- Replaced synchronous room check with asynchronous room check using `await`.
- Updated the code to use the `await` keyword before calling `self.room_uses_assistant(room)`.
- This change enables the code to generate assistant response asynchronously.
2023-11-19 16:15:28 +01:00
65bf724a0b
feat: Add method to check if room uses assistant
This commit adds a new method `room_uses_assistant` to the OpenAI class. This method allows checking whether a given room uses an assistant. It uses the `room_settings` table in the database to determine if the specified room has the `openai_assistant` setting.
2023-11-19 16:06:59 +01:00
54f56c1b1a
Add launch configuration for Python module 2023-11-19 15:38:43 +01:00
fbbe82a1fc
Refactor image generation code with dynamic size and model
The commit modifies the image generation code in the OpenAI class. The size and model of the generated image can now be dynamically set based on the provided prompt. The code has been refactored to handle different image sizes and models correctly.
2023-11-19 15:38:34 +01:00
14da88de8b
feat: Improve image generation quality selection
The code change adds a conditional statement to select the image generation quality based on the selected image model.
2023-11-19 15:26:09 +01:00
474af54ae1
Start assistant implementation to support generating responses using an assistant if the room uses an assistant. Also, add methods to create and setup an assistant for a room. 2023-11-19 15:24:22 +01:00
2269018e92
Work towards encryption support 2023-11-11 17:22:43 +01:00
09393b4216
Remove debugging output that is no longer needed 2023-11-11 14:54:40 +01:00
48f13fcf7f
Fix truncation calculation 2023-11-11 13:32:31 +01:00
0317b2f5aa
Improve handling of event and other messages for chat response
Remove limitation of number of attached images for image-aware chat completions
2023-11-11 13:26:21 +01:00
4113a02232
Add image input on models that support it, fix some bugs, bump required OpenAI version 2023-11-11 12:27:19 +01:00
c238da9b99
openai: Fix image_model assignment, add method to check if the used chat model supports images messages 2023-11-11 09:51:28 +01:00
1b290c6b92
Revert last commit 2023-11-09 12:31:46 +01:00
37a1e6a85c
Fix handling of commands in GPTBot class 2023-11-09 12:30:12 +01:00
72340095f9
Fix bot command prefix recognition and handle ignore bot commands.
- Fixed bot command prefix recognition to include prefixes starting with an asterisk (= edited messages)
- Added handling of ignoring bot commands in the '_last_n_messages' method.
2023-11-09 12:29:04 +01:00
2e6c07eb22
Fix issue with OpenAI class to set the quality parameter based on the model type. 2023-11-07 15:55:25 +01:00