Skip to content

Commit eddcc57

Browse files
committed
Add OPENAI_API_KEY as default
1 parent 82d95d5 commit eddcc57

File tree

10 files changed

+20
-38
lines changed

10 files changed

+20
-38
lines changed

agent_apis/src/functions/llm.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ async def llm(function_input: FunctionInputParams) -> str:
2525
try:
2626
log.info("llm function started", input=function_input)
2727

28-
if os.environ.get("RESTACK_API_KEY") is None:
29-
error_message = "RESTACK_API_KEY is not set"
28+
if os.environ.get("OPENAI_API_KEY") is None:
29+
error_message = "OPENAI_API_KEY is not set"
3030
raise_exception(error_message)
3131

32-
client = OpenAI(
33-
base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY")
34-
)
32+
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
3533

3634
messages = []
3735
if function_input.system_content:

agent_chat/src/functions/llm_chat.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ async def llm_chat(agent_input: LlmChatInput) -> dict[str, str]:
3030
try:
3131
log.info("llm_chat function started", agent_input=agent_input)
3232

33-
if os.environ.get("RESTACK_API_KEY") is None:
34-
error_message = "RESTACK_API_KEY is not set"
33+
if os.environ.get("OPENAI_API_KEY") is None:
34+
error_message = "OPENAI_API_KEY is not set"
3535
raise_exception(error_message)
3636

37-
client = OpenAI(
38-
base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY")
39-
)
37+
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
4038

4139
if agent_input.system_content:
4240
agent_input.messages.append(

agent_rag/src/functions/llm_chat.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ async def llm_chat(function_input: LlmChatInput) -> ChatCompletion:
3131
try:
3232
log.info("llm_chat function started", function_input=function_input)
3333

34-
if os.environ.get("RESTACK_API_KEY") is None:
35-
error_message = "RESTACK_API_KEY is not set"
34+
if os.environ.get("OPENAI_API_KEY") is None:
35+
error_message = "OPENAI_API_KEY is not set"
3636
raise_exception(error_message)
3737

38-
client = OpenAI(
39-
base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY")
40-
)
38+
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
4139

4240
if function_input.system_content:
4341
function_input.messages.append(

agent_stream/src/functions/llm_chat.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ class LlmChatInput(BaseModel):
2626
@function.defn()
2727
async def llm_chat(function_input: LlmChatInput) -> str:
2828
try:
29-
client = OpenAI(
30-
base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY")
31-
)
29+
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
3230

3331
if function_input.system_content:
3432
# Insert the system message at the beginning

agent_telephony/vapi/agent_vapi/src/functions/llm_chat.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ class LlmChatInput(BaseModel):
2626
@function.defn()
2727
async def llm_chat(function_input: LlmChatInput) -> str:
2828
try:
29-
client = OpenAI(
30-
base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY")
31-
)
29+
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
3230

3331
if function_input.system_content:
3432
# Insert the system message at the beginning

agent_todo/src/functions/llm_chat.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ async def llm_chat(function_input: LlmChatInput) -> ChatCompletion:
4343
if os.environ.get("RESTACK_API_KEY") is None:
4444
raise_exception("RESTACK_API_KEY is not set")
4545

46-
client = OpenAI(
47-
base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY")
48-
)
46+
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
4947

5048
log.info("pydantic_function_tool", tools=function_input.tools)
5149

agent_tool/src/functions/llm_chat.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,10 @@ async def llm_chat(function_input: LlmChatInput) -> ChatCompletion:
4040
try:
4141
log.info("llm_chat function started", function_input=function_input)
4242

43-
if os.environ.get("RESTACK_API_KEY") is None:
44-
raise_exception("RESTACK_API_KEY is not set")
43+
if os.environ.get("OPENAI_API_KEY") is None:
44+
raise_exception("OPENAI_API_KEY is not set")
4545

46-
client = OpenAI(
47-
base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY")
48-
)
46+
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
4947

5048
log.info("pydantic_function_tool", tools=function_input.tools)
5149

agent_video/src/functions/llm_chat.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ class LlmChatInput(BaseModel):
2626
@function.defn()
2727
async def llm_chat(function_input: LlmChatInput) -> str:
2828
try:
29-
client = OpenAI(
30-
base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY")
31-
)
29+
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
3230

3331
if function_input.system_content:
3432
# Insert the system message at the beginning

agent_voice/livekit/agent/src/functions/llm_chat.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ class LlmChatInput(BaseModel):
2626
@function.defn()
2727
async def llm_chat(function_input: LlmChatInput) -> str:
2828
try:
29-
client = OpenAI(
30-
base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY")
31-
)
29+
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
3230

3331
if function_input.system_content:
3432
# Insert the system message at the beginning

pdf_ocr/src/functions/openai_chat.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ async def openai_chat(input: OpenAiChatInput) -> str:
1717
try:
1818
log.info("openai_chat function started", input=input)
1919

20-
if (os.environ.get("RESTACK_API_KEY") is None):
21-
raise NonRetryableError("RESTACK_API_KEY is not set")
20+
if (os.environ.get("OPENAI_API_KEY") is None):
21+
raise NonRetryableError("OPENAI_API_KEY is not set")
2222

23-
client = OpenAI(base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY"))
23+
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
2424

2525
messages = []
2626
if input.system_content:

0 commit comments

Comments
 (0)