feat: Runtime Prompt Wrapper (PL-1345)
feat: move runtime to turn handler context (PL-000)
feat: bypass nlu based on current node
feat: add Extraction turn handler for LLM reprompting
feat: prompt wrapper for entity extraction (PL-1345)
chore: prettier
chore: remove old Extraction turn handler
feat: only include extraction turn handler if set to LLM
feat: shouldDoLLMExtraction at turn handler level
feat(wip): test LLM with fake data
Related PRs
Make sure you enabled the Azure OpenAI network setting for All Networks, and you have the correct baseurl from your deployment.
More detailed instructions on how to set this up with Azure OpenAI would be helpful. When I try using my custom endpoint I'm getting the following error:
Error code: 404 - {'error': {'code': 'DeploymentNotFound', 'message': 'The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.'}}
This maybe because you openned "use Tool" swith. If you close it, this error won't happen. But I suspect then you won't able to use those extended function as well which are OpenAI specific.
Hi to All,i have the same problem with my azure openai configuration.At this moment i have settings usage for all networks but i receive same error: Sorry, I had a problem talking to OpenAI: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}. How i can resolve it?
I had the same problem (error), which I have fixed by changing the config. By default it was using the gpt4o-mini model but I haven't setup a deployment with that name. Check your Azure deployments and use one that has been configured.
Thanks for your answer,i have set chat model like so and i have added gpt-4 model to configuration field.
What you have insert in the first panel for teh field version API?
I have enterered "2024-02-15-preview". ALso, the base URL should be based on your Azure setup, it's displayed on the AI Foundry site on the Home page (Azure OpenAI Endpoint)
looks like it is hard to find the way to configure using azure, i hade luck with this settings go in the AzureAi Foundry panel create a deployment
from the lefr side menu return in HOME and press "View JSON"
your base uri is at the line "OpenAI Language Model Instance API"
use this as base uri
again from HOME copy the API key 1, this will be your Api key
then in Home Assistant
for the Name: i've used the same name of the deployment i've created (gpt-4o-mini for me) Api Key, and Base Uri as told before
For the Api Version, as adviced in the previous post : 2024-02-15-preview
For Organization the name of my subscription, but i don't think it is relevant
Just to add my 2 cents.... To the base url it's added "/chat/completions" So I tried to insert "https://YourName-somedata-eastus2.cognitiveservices.azure.com/openai/deployments/gpt-4o"
Too bad that it dind't add the "?api-version=2024-08-01-preview" at the end of the endpoint. The correct endpoint (as taken from azure AI interface) should be https://YourName-somedata-eastus2.cognitiveservices.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-08-01-preview
@jekalmin could you please log the URL to make it easier to troubleshoot? Also, only guessing a solution, is it possible to use the base url "as is" if it contains "azure.com"?
Anyway thanks for the great work!
Does setting like below help?
logger:
logs:
openai: debug
yes! https://myname-code-eastus2.cognitiveservices.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-08-01-preview&--//chat/completions "401 Unauthorized" I workarounded the url adding &--// at the end to "remove" the wrong part. Don't know if this could be the problem ! I use extended open ai for openAI API without problems and Azure AI with "Azure OpenAI Conversation Custom Integration"
I just tried Azure OpenAI and also had Resource not found error, and it turned out that api_version was not correct.
As @PhotoAtomic mentioned, I created deployment of a model from Azure AI Foundry panel and got api_version from deployed model URL (2024-08-01-preview in my case)
To solve DeploymentNotFound error, creating deployment of a model from Azure AI Foundry worked for me.
If you want to test in python, try code below first.
import logging
from openai import AsyncAzureOpenAI
import asyncio
logging.basicConfig(level="DEBUG")
client = AsyncAzureOpenAI(
api_key="your-api-key",
azure_endpoint="https://your-endpoint",
api_version="2024-08-01-preview"
)
async def main():
response = await client.models.list()
print(response)
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
My fault!!!! It works...
Using your python script with data taken from https://ai.azure.com/resource/playground?wsid=/subscriptions/<subscription guid> Using "View code" (red arrovw)
There select tab "Key authentication" (red arrow)
then
api_key="<84 char string>",
azure_endpoint="https://myname-code-eastus2.openai.azure.com/",
api_version="
One question: after adding the service is it possible to change api_key, azure_enpoint and api_version?
Sounds great to hear that!
One question: after adding the service is it possible to change api_key, azure_enpoint and api_version?
No, if you want to change whatever you entered in adding it, you have to remove and re-create it using api_key, azure_endpoint, and api_version.
ok, no interface to modify... doing some trials a faster way, at my own risk and peril, I can modify modify entry.data in the JSON file .storage/core.config_entries :D
This issue comes from the fact that Azure now uses a different domain in the component code there is a function to detect if it is azure Vs OpenAI:
helpers.py
AZURE_DOMAIN_PATTERN = r"\.(openai\.azure\.com|azure-api\.net)"
def is_azure(base_url: str):
if base_url and re.search(AZURE_DOMAIN_PATTERN, base_url):
return True
return False
The problem is the new domains are like https://*******-eastus2.cognitiveservices.azure.com And this does not match the regex I was able to get this fixed just with an update to the regex as follows:
AZURE_DOMAIN_PATTERN = r"\.(openai\.azure\.com|azure-api\.net|cognitiveservices\.azure\.com)"