Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions orangecontrib/prototypes/widgets/owchatgptbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
ContextSetting
from Orange.widgets.widget import OWWidget, Input, Msg

MODELS = ["gpt-3.5-turbo", "gpt-4"]
MODELS = ["gpt-3.5-turbo", "gpt-4",'o3-mini','o1-mini','gpt-4o-mini']
Comment thread
arturborja marked this conversation as resolved.
Outdated


def run_gpt(
Expand All @@ -27,18 +27,15 @@ def run_gpt(
prompt_end: str
) -> str:
client = openai.OpenAI(api_key=api_key)
enc = tiktoken.encoding_for_model(model)
enc = tiktoken.get_encoding("o200k_base")
Comment thread
arturborja marked this conversation as resolved.
Outdated

text = enc.decode(enc.encode(text)[:3500])
content = f"{prompt_start}\n{text}.\n{prompt_end}"
response = client.chat.completions.create(
model=model,
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": content},
],
temperature=0
messages=[{"role": "user", "content": content}],
Comment thread
arturborja marked this conversation as resolved.
Outdated
)

return response.choices[0].message.content


Expand Down