Reputation: 1
Hello Stack Overflow community,
I'm working on a project that's part of the Azure Contoso Chat repo, which involves using PromptFlow, a component of Azure Machine Learning, to call CosmosDB.
I'm at the end of the tutorial, testing the flow in AI studio, and I encounter this error:
Request failed with status code 400 - NotSupported ConnectionType 0 for connection contoso-cosmos.
Here's a snippet of the code I'm using to connect to CosmosDB:
from typing import Dict
from promptflow import tool
from azure.cosmos import CosmosClient
from promptflow.connections import CustomConnection
@tool
def customer_lookup(customerId: str, conn: CustomConnection) -> str:
client = CosmosClient(url=conn.configs["endpoint"], credential=conn.secrets["key"])
db = client.get_database_client(conn.configs["databaseId"])
container = db.get_container_client(conn.configs["containerId"])
response = container.read_item(item=customerId, partition_key=customerId)
response["orders"] = response["orders"][:2]
return response
This flow works as expected when called from my local environment, but the error occurs when I run it within Azure Machine Learning's PromptFlow.
Also,I've double-checked the connection details, and they appear to be correct. I suspect there might be a specific configuration or setting within Azure Machine Learning that needs to be adjusted.
Has anyone encountered a similar issue or have any insights on how to resolve this? Any help would be greatly appreciated!
Upvotes: 0
Views: 246
Reputation: 1
I had this exact issue. Assuming you've already created manually the connection on the AI Studio, the next necessary step is to add these 2 key-pairs in addition to the 4 already mentioned in the repo.
Upvotes: 0