fix: align venice/chat.py with gitea/dev.py patterns #2

Closed
xcaliber wants to merge 4 commits from fix/venice-chat-integration into main
Owner

Summary

Fixed venice/chat.py to align with the patterns established in gitea/dev.py for consistent tool integration with Open WebUI.

Changes

Bug Fixes

  • _get_api_key() now accepts __user__ parameter - Fixes per-user API key configuration not being read from UserValves
  • Fixed UserValves initialization in __init__ - Now properly handles __user__ dict with nested valves structure
  • Added __user__ parameter to helper methods - _get_traits() and _get_available_models() now pass user context for API key resolution

Improvements

  • Added _format_error() helper - Consistent error message formatting matching gitea/dev.py patterns
  • Set self.citation = True - Enables tool usage visibility for debugging
  • Updated response formatting - Now uses markdown headers (**Header**) consistently instead of verbose "Status: 200" lines
  • Enhanced __init__ - Accepts valves parameter for framework-driven configuration injection
  • Improved error messages - More informative and consistent with gitea patterns

Version Bump

  • Bumped version from 1.2.0 to 1.3.0 with changelog entry
## Summary Fixed venice/chat.py to align with the patterns established in gitea/dev.py for consistent tool integration with Open WebUI. ## Changes ### Bug Fixes - **`_get_api_key()` now accepts `__user__` parameter** - Fixes per-user API key configuration not being read from UserValves - **Fixed UserValves initialization in `__init__`** - Now properly handles `__user__` dict with nested valves structure - **Added `__user__` parameter to helper methods** - `_get_traits()` and `_get_available_models()` now pass user context for API key resolution ### Improvements - **Added `_format_error()` helper** - Consistent error message formatting matching gitea/dev.py patterns - **Set `self.citation = True`** - Enables tool usage visibility for debugging - **Updated response formatting** - Now uses markdown headers (`**Header**`) consistently instead of verbose "Status: 200" lines - **Enhanced `__init__`** - Accepts `valves` parameter for framework-driven configuration injection - **Improved error messages** - More informative and consistent with gitea patterns ### Version Bump - Bumped version from 1.2.0 to 1.3.0 with changelog entry
xcaliber added 1 commit 2026-01-15 00:35:59 +00:00
- Fixed _get_api_key() to accept __user__ parameter for UserValves access
- Added __request__ parameter support in __init__ for framework injection
- Added _format_error() helper for consistent error handling
- Set self.citation = True for tool usage visibility
- Updated response formatting to use markdown headers consistently
- Added __user__ parameter to _get_traits and _get_available_models
- Improved error messages to be more informative
xcaliber added 1 commit 2026-01-15 00:55:04 +00:00
Author
Owner

Okay, testing discovery

the "method" _get_api_key is "duplicated", so this is an apparent runtime issue with Open WebUI

1 solution would be to make a Class at the top for the "helper functions" named after the tool we are working on, this would have the effect of a namespace

Feel free to brainstorm other ideas

I made necessary changes to get the code to save as there were pydantic issues

Okay, testing discovery the "method" _get_api_key is "duplicated", so this is an apparent runtime issue with Open WebUI 1 solution would be to make a Class at the top for the "helper functions" named after the tool we are working on, this would have the effect of a namespace Feel free to brainstorm other ideas I made necessary changes to get the code to save as there were pydantic issues
xcaliber added 1 commit 2026-01-15 11:37:21 +00:00
- Added VeniceChat class with get_api_key, truncate, format_error static methods
- Prevents Open WebUI framework method name collision issues
- All tool methods now use VeniceChat.get_api_key() pattern
- Version bump to 1.4.0
xcaliber added 1 commit 2026-01-15 11:51:04 +00:00
xcaliber closed this pull request 2026-01-15 12:09:37 +00:00

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-webui-automation/tools#2
No description provided.