diff --git a/.env.sample b/.env.sample index d1a224af..8235bf71 100644 --- a/.env.sample +++ b/.env.sample @@ -3,4 +3,11 @@ CONTOSO_AI_SERVICES_KEY= CONTOSO_SEARCH_ENDPOINT= CONTOSO_SEARCH_KEY= COSMOS_ENDPOINT= -COSMOS_KEY= \ No newline at end of file +COSMOS_KEY= + +# These connection are for running the intent promotflow +SUPPORT_ENDPOINT = "" +SUPPORT_KEY = "" + +CHAT_ENDPOINT = "" +CHAT_KEY = "" \ No newline at end of file diff --git a/connections/create-connections.ipynb b/connections/create-connections.ipynb index 8161c699..b5cade29 100644 --- a/connections/create-connections.ipynb +++ b/connections/create-connections.ipynb @@ -17,7 +17,7 @@ ")\n", "from dotenv import load_dotenv\n", "\n", - "load_dotenv()\n", + "load_dotenv(\"../.env.sample\")\n", "\n", "pf = PFClient()" ] @@ -98,18 +98,23 @@ "# Create the local contoso-search connection\n", "SUPPORT_ENDPOINT = os.environ[\"SUPPORT_ENDPOINT\"]\n", "SUPPORT_KEY = os.environ[\"SUPPORT_KEY\"]\n", - "connection = CustomConnection(\n", - " name=\"support-endpoint\",\n", - " configs={\n", - " \"api_base\": SUPPORT_ENDPOINT,\n", - " },\n", - " secrets={\"api_key\": SUPPORT_KEY},\n", - ")\n", + "print(SUPPORT_ENDPOINT)\n", "\n", + "if(SUPPORT_ENDPOINT == \"\"):\n", + " print(\"Skipping support connection creation, missing environment variables\")\n", + "else:\n", + " connection = CustomConnection(\n", + " name=\"support-endpoint\",\n", + " configs={\n", + " \"api_base\": SUPPORT_ENDPOINT,\n", + " },\n", + " secrets={\"api_key\": SUPPORT_KEY},\n", + " )\n", "\n", - "print(f\"Creating connection {connection.name}...\")\n", - "result = pf.connections.create_or_update(connection)\n", - "print(result)" + "\n", + " print(f\"Creating connection {connection.name}...\")\n", + " result = pf.connections.create_or_update(connection)\n", + " print(result)" ] }, { @@ -121,18 +126,22 @@ "# Create the local contoso-search connection\n", "CHAT_ENDPOINT = os.environ[\"CHAT_ENDPOINT\"]\n", "CHAT_KEY = os.environ[\"CHAT_KEY\"]\n", - "connection = CustomConnection(\n", - " name=\"chat-endpoint\",\n", - " configs={\n", - " \"api_base\": CHAT_ENDPOINT,\n", - " },\n", - " secrets={\"api_key\": CHAT_KEY},\n", - ")\n", "\n", + "if(CHAT_ENDPOINT == \"\"):\n", + " print(\"Skipping chat connection creation, missing environment variables\")\n", + "else:\n", + " connection = CustomConnection(\n", + " name=\"chat-endpoint\",\n", + " configs={\n", + " \"api_base\": CHAT_ENDPOINT,\n", + " },\n", + " secrets={\"api_key\": CHAT_KEY},\n", + " )\n", "\n", - "print(f\"Creating connection {connection.name}...\")\n", - "result = pf.connections.create_or_update(connection)\n", - "print(result)" + "\n", + " print(f\"Creating connection {connection.name}...\")\n", + " result = pf.connections.create_or_update(connection)\n", + " print(result)" ] } ],