chatbot responds with different answers for same question

Admin 50 Reputation points
2025-08-02T11:26:35.3966667+00:00

Our chatbot responds different answers to the same question.

we are using our own data (2000 files) uploaded to Blob storage and Created index and Built in RAG functionality from Import and Vectorize data which has created skillset and using cosmodb for storing chat history, enabled schematic ranker too.

we use a GPT 4.1 deployment model, with text-embedding003 model.

AZURE_OPENAI_TEMPERATURE = 1

AZURE_OPENAI_TOP_P = 1

AZURE_SEARCH_STRICTNESS = 3

AZURE_SEARCH_TOP_K = 5

Could you help

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
{count} votes

Accepted answer
  1. Manas Mohanty 8,325 Reputation points Microsoft External Staff Moderator
    2025-08-05T01:37:22.69+00:00

    Hi Admin

    Thank you for sharing the configurations.

    Here are key findings

    Authentications

    "name": "AUTH_ENABLED",

    "value": False

    will be accessible to public without authentication (recommend you to add Google, Entra or any other authentication)

    Environment variables

    Environment variables for Embedding endpoint and keys are missing which is crucial

    AZURE_OPENAI_EMBEDDING_ENDPOINT

    AZURE_OPENAI_EMBEDDING_KEY

    Top_P - "value": "0.1", - Can you set it to 0.2 or 0.3

    Index Optimization

    Weaknesses:

    • No Field for Business Entity: There's no business_unit or organization field to match “Sunrun business.”
    • No Project-Specific Field: No project_name, project_owner, or project_type field to match “projects.”
    • No Facetable Fields: Limits filtering by business unit or project category.
    • No Suggesters: Reduces autocomplete and guided search capabilities.

    Please add few more fields

    {
      "name": "business_unit",
      "type": "Edm.String",
      "searchable": true,
      "filterable": true,
      "retrievable": true,
      "stored": true,
      "sortable": false,
      "facetable": true,
      "key": false
    },
    {
      "name": "project_name",
      "type": "Edm.String",
      "searchable": true,
      "filterable": true,
      "retrievable": true,
      "stored": true,
      "sortable": true,
      "facetable": true,
      "key": false
    },
    {
      "name": "project_owner",
      "type": "Edm.String",
      "searchable": true,
      "filterable": true,
      "retrievable": true,
      "stored": true,
      "sortable": false,
      "facetable": false,
      "key": false
    }
    
    
    

    Update on Semantic ranking

    
    
    "prioritizedFields": {
      "titleField": {
        "fieldName": "title"
      },
      "prioritizedContentFields": [
        { "fieldName": "chunk" },
        { "fieldName": "project_name" }
      ],
      "prioritizedKeywordsFields": [
        { "fieldName": "business_unit" },
        { "fieldName": "project_owner" }
      ]
    }
    

    Parent Id , title, storage path url can be set as searchable

    Sample queries should be used

    1. list all the projects or initiative being run by "sunrun" business
    2. Find all "Sunrun business" unit projects

    Hope it helps address the issue.

    Please let us know if the issue still persists after implementing all above index and query optimization.

    Thank you


    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Divyesh Govaerdhanan 8,345 Reputation points
    2025-08-03T16:46:50.8166667+00:00

    Hello,

    Welcome to Microsoft Q&A,

    Even with identical queries and retrieved documents, chatbot responses may vary due to the following reasons:

    1. High Model Temperature (temperature = 1)
      1. This controls randomness. A value of 1 allows the model to generate more diverse (and sometimes inconsistent) outputs. Suggestion: Set AZURE_OPENAI_TEMPERATURE = 0.2–0.4 to improve consistency.
    2. TOP_P = 1 (Unfiltered Sampling)
      1. When combined with high temperature, this encourages creativity but reduces determinism. Suggestion: Try reducing AZURE_OPENAI_TOP_P to 0.8 or lower for more focused sampling.
    3. Variability in Retrieved Chunks (TOP_K = 5)
      1. Each call may retrieve slightly different documents or orders depending on semantic similarity and ranking noise. Suggestion: Use semantic_captions = true, and consider setting AZURE_SEARCH_STRICTNESS = 4–5 to tighten relevance filtering.

    Please Upvote and accept the answer if it helps!!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.