Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,11 @@ import json
|
|
| 4 |
import gradio as gr
|
| 5 |
from openai import OpenAI
|
| 6 |
|
| 7 |
-
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
BASIC_PROMPT = """You are a helpful assistant that processes emails."""
|
| 10 |
|
|
@@ -304,7 +308,8 @@ def run_agent(system_prompt, email, show_raw_output):
|
|
| 304 |
|
| 305 |
try:
|
| 306 |
first_response = client.chat.completions.create(
|
| 307 |
-
model="gpt-4o-mini",
|
|
|
|
| 308 |
messages=[
|
| 309 |
{"role": "system", "content": system_prompt},
|
| 310 |
{"role": "user", "content": email},
|
|
@@ -326,7 +331,8 @@ def run_agent(system_prompt, email, show_raw_output):
|
|
| 326 |
)
|
| 327 |
|
| 328 |
second_response = client.chat.completions.create(
|
| 329 |
-
model="gpt-4o-mini",
|
|
|
|
| 330 |
messages=[
|
| 331 |
{"role": "system", "content": system_prompt},
|
| 332 |
{"role": "user", "content": email},
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
from openai import OpenAI
|
| 6 |
|
| 7 |
+
#client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
|
| 8 |
+
client = OpenAI(
|
| 9 |
+
api_key=os.environ["OPENROUTER_API_KEY"],
|
| 10 |
+
base_url="https://openrouter.ai/api/v1",
|
| 11 |
+
) # for using openrouter instead
|
| 12 |
|
| 13 |
BASIC_PROMPT = """You are a helpful assistant that processes emails."""
|
| 14 |
|
|
|
|
| 308 |
|
| 309 |
try:
|
| 310 |
first_response = client.chat.completions.create(
|
| 311 |
+
#model="gpt-4o-mini",
|
| 312 |
+
model="openai/gpt-4o-mini", # for using openrouter instead
|
| 313 |
messages=[
|
| 314 |
{"role": "system", "content": system_prompt},
|
| 315 |
{"role": "user", "content": email},
|
|
|
|
| 331 |
)
|
| 332 |
|
| 333 |
second_response = client.chat.completions.create(
|
| 334 |
+
#model="gpt-4o-mini",
|
| 335 |
+
model="openai/gpt-4o-mini", # for using openrouter instead
|
| 336 |
messages=[
|
| 337 |
{"role": "system", "content": system_prompt},
|
| 338 |
{"role": "user", "content": email},
|