Skip to content

Update owchatgptbase.py - #278

Closed
arturborja wants to merge 2 commits into
biolab:masterfrom
arturborja:patch-1
Closed

arturborja wants to merge 2 commits into
biolab:masterfrom
arturborja:patch-1

Conversation

@arturborja

@arturborja arturborja commented Mar 18, 2025 •

Copy link
Copy Markdown

Fix compatibility with OpenAI API models

Corrigindo compatibilidade com modelos no OpenAI API

Issue
Description of changes

Summary

This PR fixes compatibility issues with OpenAI API models by removing unsupported parameters.

Changes

  • Removed system role from messages to support all models.
  • Ensured temperature is not explicitly set for models that do not allow custom values.

Why?

Some models (e.g., o1-mini) do not support the system role or custom temperature values, causing errors.

Includes
  • Code changes
  • Tests
  • Documentation

Fix compatibility with OpenAI API models

Corrigindo compatibilidade com modelos no OpenAI API
Comment thread orangecontrib/prototypes/widgets/owchatgptbase.py Outdated
Comment thread orangecontrib/prototypes/widgets/owchatgptbase.py Outdated
Comment thread orangecontrib/prototypes/widgets/owchatgptbase.py Outdated
Double quotes and spaces: Updated MODELS to ["gpt-3.5-turbo", "gpt-4", "o3-mini", "o1-mini", "gpt-4o-mini"] with " and spaces for consistency and readability.  

Encoding and library: Replaced hardcoded "o200k_base" with tiktoken.encoding_for_model(model) to match the encoding available for each model. Suggest tiktoken>=0.7.0 in requirements.txt for new encoding support.  

Parameters: Kept temperature=0 for old models where it’s supported, omitted it for new ones that may not, using it where possible.
@arturborja

Copy link
Copy Markdown
Author

@VesnaT I’m looking forward to you accepting my pull request
Please

@VesnaT

VesnaT commented Aug 22, 2025

Copy link
Copy Markdown
Contributor

Thank you for your contribution. However, we are afraid that the solution is outdated, and therefore we are closing this pull request.

@VesnaT VesnaT closed this Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants