Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure AI search extension Unauthorized #475

Open
jCoreAI opened this issue Jan 29, 2025 · 3 comments
Open

Azure AI search extension Unauthorized #475

jCoreAI opened this issue Jan 29, 2025 · 3 comments

Comments

@jCoreAI
Copy link

jCoreAI commented Jan 29, 2025

Hello!

so i have added ApiKey from Search Service
SearchName from Search Service
IndexName from Search Service

i can speak to the search service through other Blazor project and call the ApiKey, searchName, IndexName

but with AzureChat i always end up with "There was an error calling the api: Unauthorized"

Status 200 for Fetching.

any other things i have missed? have followed Documentation step by step and looked through other issues here but with no success.

Image
my Search index

getting my Web App service from Web App and using the Default domain: "ExampleWebAppName
API endpoint POST https://ExampleWebAppName.azurewebsites.net/api/document

@jCoreAI jCoreAI changed the title Azure AI search extension Azure AI search extension Unauthorized Jan 29, 2025
@jCoreAI
Copy link
Author

jCoreAI commented Feb 4, 2025

Or am i mistaken, can i "only" reach the Search service made by the Default deployment with Azure but instead different indexes that i make within that Search Service?

because what i'm trying to do is to connect to my "other" resource that has a Search service and it's index.
made sure CORS is set to all, Tested the Search service with other application and can reach it.

am i missing a Environment Variable in the Azure Chat Web App?
so long story short, i can connect to the Search Service API on my other application but it wont do it here
"There was an error calling the api: Unauthorized"
best regards..

@fsch-ppi
Copy link

fsch-ppi commented Feb 6, 2025

You can connect different indexes via extensions.
There are two things that you need to be aware of:

  1. If you are testing the extension locally, it will fail, because keys are stored within the azure key vault and cannot be retrieved to your local machine - only by resources in the same resource group (afaik).

  2. I think the endpoint you are speaking to is not right:
    endpoint:
    https://.search.windows.net/indexes//docs/search?api-version=2023-11-01

headers:
api-key
ContentType application/json

If you are interested, here is an example gpt function definition. The function will get 5 results from the search index and retrieve only the content column from the index.
{ "name": "Document-Search", "parameters": { "type": "object", "properties": { "body": { "type": "object", "description": "Body of the Search Post-Query", "properties": { "search": { "type": "string", "description": "The semantic search term from the user" }, "top": { "type": "integer", "description": "The number of top results to return", "default": 5 }, "select": { "type": "string", "description": "The fields to return in the search results", "default": "content" } }, "required": ["search", "top", "select"] } }, "required": ["body"] }, "description": "You must use this to search for content based on user questions." }

Hope I got your problem and this helps - if not, feel free to describe further, I have worked quite a lot with adding a search service to query via the chatbot.

@jCoreAI
Copy link
Author

jCoreAI commented Feb 7, 2025

Thank you thank you thank you, Yes it works now with creating it as a "New Extension"
Content-Type ***
api-key: ***
POST: https://FakeName.search.windows.net/indexes/FakeIndexName/docs/search?api-version=2024-07-01

gets me wondering

whats the options regarding the

Image

because i would like to use the Citations format in the Azure AI search service option on AzureChat
Use the format for your citation {% citation items=[{name:"filename 1",id:"file id"}, {name:"filename 2",id:"file id"}] /%}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants