Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,6 @@ import datetime
|
|
9 |
import difflib
|
10 |
from tiktoken import get_encoding
|
11 |
from openai import AzureOpenAI
|
12 |
-
import httpx
|
13 |
|
14 |
# Clear proxy environment variables to avoid interference
|
15 |
os.environ.pop("HTTP_PROXY", None)
|
@@ -123,12 +122,10 @@ class TextEditor:
|
|
123 |
# OpenAIApi class
|
124 |
class OpenAIApi:
|
125 |
def __init__(self, preprompt="", endpoint="https://T-App-GPT4o.openai.azure.com/openai/v1/", model="gpt-4o", api_key=None):
|
126 |
-
http_client = httpx.Client(proxies=None)
|
127 |
self.client = AzureOpenAI(
|
128 |
azure_endpoint=endpoint,
|
129 |
api_key=api_key or os.getenv("AZURE_OPENAI_API_KEY"),
|
130 |
-
api_version="2025-01-01-preview"
|
131 |
-
http_client=http_client
|
132 |
)
|
133 |
self.model = model
|
134 |
self.preprompt = preprompt
|
@@ -167,7 +164,7 @@ class OpenAIApi:
|
|
167 |
"type": "function",
|
168 |
"name": "paste_text",
|
169 |
"description": "Paste clipboard content into a conversation chunk.",
|
170 |
-
"
|
171 |
"type": "object",
|
172 |
"properties": {
|
173 |
"chunk_id": {"type": "string", "description": "ID of the conversation chunk"},
|
|
|
9 |
import difflib
|
10 |
from tiktoken import get_encoding
|
11 |
from openai import AzureOpenAI
|
|
|
12 |
|
13 |
# Clear proxy environment variables to avoid interference
|
14 |
os.environ.pop("HTTP_PROXY", None)
|
|
|
122 |
# OpenAIApi class
|
123 |
class OpenAIApi:
|
124 |
def __init__(self, preprompt="", endpoint="https://T-App-GPT4o.openai.azure.com/openai/v1/", model="gpt-4o", api_key=None):
|
|
|
125 |
self.client = AzureOpenAI(
|
126 |
azure_endpoint=endpoint,
|
127 |
api_key=api_key or os.getenv("AZURE_OPENAI_API_KEY"),
|
128 |
+
api_version="2025-01-01-preview"
|
|
|
129 |
)
|
130 |
self.model = model
|
131 |
self.preprompt = preprompt
|
|
|
164 |
"type": "function",
|
165 |
"name": "paste_text",
|
166 |
"description": "Paste clipboard content into a conversation chunk.",
|
167 |
+
"parameters": {
|
168 |
"type": "object",
|
169 |
"properties": {
|
170 |
"chunk_id": {"type": "string", "description": "ID of the conversation chunk"},
|