From eddcc5785c800a0814767188d5886621ae707a5e Mon Sep 17 00:00:00 2001 From: leawn Date: Mon, 12 May 2025 15:36:00 +0200 Subject: [PATCH 1/2] Add OPENAI_API_KEY as default --- agent_apis/src/functions/llm.py | 8 +++----- agent_chat/src/functions/llm_chat.py | 8 +++----- agent_rag/src/functions/llm_chat.py | 8 +++----- agent_stream/src/functions/llm_chat.py | 4 +--- agent_telephony/vapi/agent_vapi/src/functions/llm_chat.py | 4 +--- agent_todo/src/functions/llm_chat.py | 4 +--- agent_tool/src/functions/llm_chat.py | 8 +++----- agent_video/src/functions/llm_chat.py | 4 +--- agent_voice/livekit/agent/src/functions/llm_chat.py | 4 +--- pdf_ocr/src/functions/openai_chat.py | 6 +++--- 10 files changed, 20 insertions(+), 38 deletions(-) diff --git a/agent_apis/src/functions/llm.py b/agent_apis/src/functions/llm.py index f313542..887ec50 100644 --- a/agent_apis/src/functions/llm.py +++ b/agent_apis/src/functions/llm.py @@ -25,13 +25,11 @@ async def llm(function_input: FunctionInputParams) -> str: try: log.info("llm function started", input=function_input) - if os.environ.get("RESTACK_API_KEY") is None: - error_message = "RESTACK_API_KEY is not set" + if os.environ.get("OPENAI_API_KEY") is None: + error_message = "OPENAI_API_KEY is not set" raise_exception(error_message) - client = OpenAI( - base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY") - ) + client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY")) messages = [] if function_input.system_content: diff --git a/agent_chat/src/functions/llm_chat.py b/agent_chat/src/functions/llm_chat.py index 6afa850..f0dde51 100644 --- a/agent_chat/src/functions/llm_chat.py +++ b/agent_chat/src/functions/llm_chat.py @@ -30,13 +30,11 @@ async def llm_chat(agent_input: LlmChatInput) -> dict[str, str]: try: log.info("llm_chat function started", agent_input=agent_input) - if os.environ.get("RESTACK_API_KEY") is None: - error_message = "RESTACK_API_KEY is not set" + if os.environ.get("OPENAI_API_KEY") is None: + error_message = "OPENAI_API_KEY is not set" raise_exception(error_message) - client = OpenAI( - base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY") - ) + client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY")) if agent_input.system_content: agent_input.messages.append( diff --git a/agent_rag/src/functions/llm_chat.py b/agent_rag/src/functions/llm_chat.py index a62f1a0..72b726e 100644 --- a/agent_rag/src/functions/llm_chat.py +++ b/agent_rag/src/functions/llm_chat.py @@ -31,13 +31,11 @@ async def llm_chat(function_input: LlmChatInput) -> ChatCompletion: try: log.info("llm_chat function started", function_input=function_input) - if os.environ.get("RESTACK_API_KEY") is None: - error_message = "RESTACK_API_KEY is not set" + if os.environ.get("OPENAI_API_KEY") is None: + error_message = "OPENAI_API_KEY is not set" raise_exception(error_message) - client = OpenAI( - base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY") - ) + client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY")) if function_input.system_content: function_input.messages.append( diff --git a/agent_stream/src/functions/llm_chat.py b/agent_stream/src/functions/llm_chat.py index 4bee140..38e841a 100644 --- a/agent_stream/src/functions/llm_chat.py +++ b/agent_stream/src/functions/llm_chat.py @@ -26,9 +26,7 @@ class LlmChatInput(BaseModel): @function.defn() async def llm_chat(function_input: LlmChatInput) -> str: try: - client = OpenAI( - base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY") - ) + client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY")) if function_input.system_content: # Insert the system message at the beginning diff --git a/agent_telephony/vapi/agent_vapi/src/functions/llm_chat.py b/agent_telephony/vapi/agent_vapi/src/functions/llm_chat.py index 48ccff3..56582d0 100644 --- a/agent_telephony/vapi/agent_vapi/src/functions/llm_chat.py +++ b/agent_telephony/vapi/agent_vapi/src/functions/llm_chat.py @@ -26,9 +26,7 @@ class LlmChatInput(BaseModel): @function.defn() async def llm_chat(function_input: LlmChatInput) -> str: try: - client = OpenAI( - base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY") - ) + client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY")) if function_input.system_content: # Insert the system message at the beginning diff --git a/agent_todo/src/functions/llm_chat.py b/agent_todo/src/functions/llm_chat.py index 57fe1c9..76b2113 100644 --- a/agent_todo/src/functions/llm_chat.py +++ b/agent_todo/src/functions/llm_chat.py @@ -43,9 +43,7 @@ async def llm_chat(function_input: LlmChatInput) -> ChatCompletion: if os.environ.get("RESTACK_API_KEY") is None: raise_exception("RESTACK_API_KEY is not set") - client = OpenAI( - base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY") - ) + client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY")) log.info("pydantic_function_tool", tools=function_input.tools) diff --git a/agent_tool/src/functions/llm_chat.py b/agent_tool/src/functions/llm_chat.py index c2f8869..5133289 100644 --- a/agent_tool/src/functions/llm_chat.py +++ b/agent_tool/src/functions/llm_chat.py @@ -40,12 +40,10 @@ async def llm_chat(function_input: LlmChatInput) -> ChatCompletion: try: log.info("llm_chat function started", function_input=function_input) - if os.environ.get("RESTACK_API_KEY") is None: - raise_exception("RESTACK_API_KEY is not set") + if os.environ.get("OPENAI_API_KEY") is None: + raise_exception("OPENAI_API_KEY is not set") - client = OpenAI( - base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY") - ) + client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY")) log.info("pydantic_function_tool", tools=function_input.tools) diff --git a/agent_video/src/functions/llm_chat.py b/agent_video/src/functions/llm_chat.py index 48ccff3..56582d0 100644 --- a/agent_video/src/functions/llm_chat.py +++ b/agent_video/src/functions/llm_chat.py @@ -26,9 +26,7 @@ class LlmChatInput(BaseModel): @function.defn() async def llm_chat(function_input: LlmChatInput) -> str: try: - client = OpenAI( - base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY") - ) + client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY")) if function_input.system_content: # Insert the system message at the beginning diff --git a/agent_voice/livekit/agent/src/functions/llm_chat.py b/agent_voice/livekit/agent/src/functions/llm_chat.py index e18fce4..3fb7412 100644 --- a/agent_voice/livekit/agent/src/functions/llm_chat.py +++ b/agent_voice/livekit/agent/src/functions/llm_chat.py @@ -26,9 +26,7 @@ class LlmChatInput(BaseModel): @function.defn() async def llm_chat(function_input: LlmChatInput) -> str: try: - client = OpenAI( - base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY") - ) + client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY")) if function_input.system_content: # Insert the system message at the beginning diff --git a/pdf_ocr/src/functions/openai_chat.py b/pdf_ocr/src/functions/openai_chat.py index 55bc97f..a670eca 100644 --- a/pdf_ocr/src/functions/openai_chat.py +++ b/pdf_ocr/src/functions/openai_chat.py @@ -17,10 +17,10 @@ async def openai_chat(input: OpenAiChatInput) -> str: try: log.info("openai_chat function started", input=input) - if (os.environ.get("RESTACK_API_KEY") is None): - raise NonRetryableError("RESTACK_API_KEY is not set") + if (os.environ.get("OPENAI_API_KEY") is None): + raise NonRetryableError("OPENAI_API_KEY is not set") - client = OpenAI(base_url="https://ai.restack.io", api_key=os.environ.get("RESTACK_API_KEY")) + client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY")) messages = [] if input.system_content: From 8850c66bfb93973f6330ba1e5b86de840e5b4415 Mon Sep 17 00:00:00 2001 From: leawn Date: Mon, 12 May 2025 15:41:00 +0200 Subject: [PATCH 2/2] Remove RESTACK_ENGINE_ envs from env.example --- agent_apis/.env.Example | 9 +-------- agent_chat/.env.Example | 9 +-------- agent_humanloop/.env.Example | 7 +------ agent_stream/.env.Example | 9 +-------- .../twilio_livekit/agent_twilio/.env.Example | 13 +------------ agent_telephony/vapi/agent_vapi/.env.Example | 14 ++------------ agent_todo/.env.Example | 8 +------- agent_voice/livekit/agent/.env.example | 10 +--------- agent_voice/livekit/livekit_pipeline/.env.example | 9 +-------- encryption/.env.example | 7 +------ pdf_ocr/.env.Example | 10 +--------- production_demo/.env.Example | 7 +------ 12 files changed, 13 insertions(+), 99 deletions(-) diff --git a/agent_apis/.env.Example b/agent_apis/.env.Example index 9f017ee..9fe6ea8 100644 --- a/agent_apis/.env.Example +++ b/agent_apis/.env.Example @@ -1,8 +1 @@ -OPENAI_API_KEY= - -# Restack Cloud (Optional) - -# RESTACK_ENGINE_ID= -# RESTACK_ENGINE_API_KEY= -# RESTACK_ENGINE_ADDRESS= -# RESTACK_CLOUD_TOKEN= +OPENAI_API_KEY= \ No newline at end of file diff --git a/agent_chat/.env.Example b/agent_chat/.env.Example index 976af24..9fe6ea8 100644 --- a/agent_chat/.env.Example +++ b/agent_chat/.env.Example @@ -1,8 +1 @@ -# Restack Cloud (Optional) - -# RESTACK_ENGINE_ID= -# RESTACK_ENGINE_API_KEY= -# RESTACK_ENGINE_API_ADDRESS= -# RESTACK_ENGINE_ADDRESS= - -# RESTACK_API_KEY= +OPENAI_API_KEY= \ No newline at end of file diff --git a/agent_humanloop/.env.Example b/agent_humanloop/.env.Example index 37f2354..9fe6ea8 100644 --- a/agent_humanloop/.env.Example +++ b/agent_humanloop/.env.Example @@ -1,6 +1 @@ -# Restack Cloud (Optional) - -# RESTACK_ENGINE_ID= -# RESTACK_ENGINE_API_KEY= -# RESTACK_ENGINE_ADDRESS= -# RESTACK_CLOUD_TOKEN= +OPENAI_API_KEY= \ No newline at end of file diff --git a/agent_stream/.env.Example b/agent_stream/.env.Example index 976af24..9fe6ea8 100644 --- a/agent_stream/.env.Example +++ b/agent_stream/.env.Example @@ -1,8 +1 @@ -# Restack Cloud (Optional) - -# RESTACK_ENGINE_ID= -# RESTACK_ENGINE_API_KEY= -# RESTACK_ENGINE_API_ADDRESS= -# RESTACK_ENGINE_ADDRESS= - -# RESTACK_API_KEY= +OPENAI_API_KEY= \ No newline at end of file diff --git a/agent_telephony/twilio_livekit/agent_twilio/.env.Example b/agent_telephony/twilio_livekit/agent_twilio/.env.Example index c02e4aa..0d00270 100644 --- a/agent_telephony/twilio_livekit/agent_twilio/.env.Example +++ b/agent_telephony/twilio_livekit/agent_twilio/.env.Example @@ -1,5 +1,3 @@ - -RESTACK_API_KEY= OPENAI_API_KEY= LIVEKIT_API_KEY= @@ -15,13 +13,4 @@ ELEVEN_API_KEY= DEEPGRAM_API_KEY= OPENAI_API_KEY= -GCP_CREDENTIALS= - -# Restack Cloud (Optional) - -# RESTACK_ENGINE_ID= -# RESTACK_ENGINE_API_KEY= -# RESTACK_ENGINE_API_ADDRESS= -# RESTACK_ENGINE_ADDRESS= - - +GCP_CREDENTIALS= \ No newline at end of file diff --git a/agent_telephony/vapi/agent_vapi/.env.Example b/agent_telephony/vapi/agent_vapi/.env.Example index d08417b..8ee1dcb 100644 --- a/agent_telephony/vapi/agent_vapi/.env.Example +++ b/agent_telephony/vapi/agent_vapi/.env.Example @@ -1,12 +1,2 @@ - -RESTACK_API_KEY= -VAPI_TOKEN= - -# Restack Cloud (Optional) - -# RESTACK_ENGINE_ID= -# RESTACK_ENGINE_API_KEY= -# RESTACK_ENGINE_API_ADDRESS= -# RESTACK_ENGINE_ADDRESS= - - +OPENAI_API_KEY= +VAPI_TOKEN= \ No newline at end of file diff --git a/agent_todo/.env.Example b/agent_todo/.env.Example index 645aad1..9fe6ea8 100644 --- a/agent_todo/.env.Example +++ b/agent_todo/.env.Example @@ -1,7 +1 @@ -# Restack Cloud (Optional) - -# RESTACK_ENGINE_ID= -# RESTACK_ENGINE_API_KEY= -# RESTACK_ENGINE_API_ADDRESS= -# RESTACK_ENGINE_ADDRESS= -# RESTACK_CLOUD_TOKEN= +OPENAI_API_KEY= \ No newline at end of file diff --git a/agent_voice/livekit/agent/.env.example b/agent_voice/livekit/agent/.env.example index 5fb0a76..1b66929 100644 --- a/agent_voice/livekit/agent/.env.example +++ b/agent_voice/livekit/agent/.env.example @@ -1,4 +1,3 @@ -RESTACK_API_KEY= LIVEKIT_API_KEY= LIVEKIT_API_SECRET= LIVEKIT_URL="wss://XXXXlivekit.cloud" @@ -10,11 +9,4 @@ TWILIO_TRUNK_AUTH_PASSWORD= ELEVEN_API_KEY= DEEPGRAM_API_KEY= -OPENAI_API_KEY= - -# Restack Cloud (Optional) - -# RESTACK_ENGINE_ID= -# RESTACK_ENGINE_API_KEY= -# RESTACK_ENGINE_API_ADDRESS= -# RESTACK_ENGINE_ADDRESS= \ No newline at end of file +OPENAI_API_KEY= \ No newline at end of file diff --git a/agent_voice/livekit/livekit_pipeline/.env.example b/agent_voice/livekit/livekit_pipeline/.env.example index 3ff7801..240bbbe 100644 --- a/agent_voice/livekit/livekit_pipeline/.env.example +++ b/agent_voice/livekit/livekit_pipeline/.env.example @@ -4,11 +4,4 @@ LIVEKIT_API_SECRET= OPENAI_API_KEY= DEEPGRAM_API_KEY= -CARTESIA_API_KEY= - -# Restack Cloud (Optional) - -# RESTACK_ENGINE_ID= -# RESTACK_ENGINE_API_KEY= -# RESTACK_ENGINE_API_ADDRESS= -# RESTACK_ENGINE_ADDRESS= \ No newline at end of file +CARTESIA_API_KEY= \ No newline at end of file diff --git a/encryption/.env.example b/encryption/.env.example index 37f2354..9fe6ea8 100644 --- a/encryption/.env.example +++ b/encryption/.env.example @@ -1,6 +1 @@ -# Restack Cloud (Optional) - -# RESTACK_ENGINE_ID= -# RESTACK_ENGINE_API_KEY= -# RESTACK_ENGINE_ADDRESS= -# RESTACK_CLOUD_TOKEN= +OPENAI_API_KEY= \ No newline at end of file diff --git a/pdf_ocr/.env.Example b/pdf_ocr/.env.Example index 0f3ec57..9fe6ea8 100644 --- a/pdf_ocr/.env.Example +++ b/pdf_ocr/.env.Example @@ -1,9 +1 @@ - -OPENAI_API_KEY= - -# Restack Cloud (Optional) - -# RESTACK_ENGINE_ID= -# RESTACK_ENGINE_API_KEY= -# RESTACK_ENGINE_ADDRESS= -# RESTACK_CLOUD_TOKEN= +OPENAI_API_KEY= \ No newline at end of file diff --git a/production_demo/.env.Example b/production_demo/.env.Example index f5c51f8..9fe6ea8 100644 --- a/production_demo/.env.Example +++ b/production_demo/.env.Example @@ -1,6 +1 @@ -# Restack Cloud (Optional) - -# RESTACK_ENGINE_ID= -# RESTACK_ENGINE_API_KEY= -# RESTACK_ENGINE_ADDRESS= -# RESTACK_ENGINE_API_ADDRESS= +OPENAI_API_KEY= \ No newline at end of file