Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,16 +4,13 @@ import os
|
|
| 4 |
|
| 5 |
openai.api_key = os.environ["OpenAPI_Key"]
|
| 6 |
|
|
|
|
| 7 |
def api_call(messages, temperature=0.5, model="gpt-3.5-turbo"):
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
)
|
| 14 |
-
return response.choices[0].message['content']
|
| 15 |
-
except Exception as e:
|
| 16 |
-
return f"API call failed: {str(e)}"
|
| 17 |
|
| 18 |
def chunk_HTMLs(text, delimiter="HTML (ID:"):
|
| 19 |
HTMLs = text.split(delimiter)
|
|
|
|
| 4 |
|
| 5 |
openai.api_key = os.environ["OpenAPI_Key"]
|
| 6 |
|
| 7 |
+
# Function to make API call
|
| 8 |
def api_call(messages, temperature=0.5, model="gpt-3.5-turbo"):
|
| 9 |
+
return openai.chat.completions.create(
|
| 10 |
+
messages=messages,
|
| 11 |
+
temperature=temperature,
|
| 12 |
+
model=model
|
| 13 |
+
).choices[0].message.content
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
def chunk_HTMLs(text, delimiter="HTML (ID:"):
|
| 16 |
HTMLs = text.split(delimiter)
|