microsoft / teams-ai

SDK focused on building AI based applications and extensions for Microsoft Teams and other Bot Framework channels
MIT License
394 stars 170 forks source link

[Bug]: default prompt is ignored when making `data_source` calls #1921

Closed allanmo79 closed 1 day ago

allanmo79 commented 1 month ago

Language

Python

Version

latest

Description

Adding data_sources to config JSON kills custom promts from skpromt.txt. While testing custom promting i noticed that when i add a custom datasource to config (azure_search) AI dosnt apply in the maner described in skpromt.txt. If i remove datasource everything works again. Seems like a bug to me, but could be i missed something?

Reproduction Steps

1.Added "Always reply as a pirate" to skpromt.txt in /prompts/chat
2.Test bot using bot framework emulator, bot answers with expected syntax
3.Added datasource to config.json data_sources (ai search with indexed pdf file)
4.Pirate syntax i gone, but i can query data in pdf file
...
corinagum commented 3 weeks ago

@allanmo79, I have seen this too with other bots where the prompt is attached to the api call but not used in the response for the data_source query.

@aacebo I would say this isn't exactly a bug, more like a known occurrence -- we know that the prompt is ignored by data_source when sending those api calls. Do you have thoughts on this one in terms of modifying the api call at all?

allanmo79 commented 3 days ago

sry for late response. Is there any way i can manually add the prompts through the "Promptmanager" ?

allanmo79 commented 1 day ago

Found a hack, apparently this is a bug in Azure OpenAI, when using BYOD, you can simply add your prompts in the roleInformation parameter of the datasource:

`config.json

 "data_sources": [
      {
        "name": "azure_search",
        "type": "azure_search",
        "parameters": {
          "endpoint": "https://..........",
          "index_name": "''''''''",
          "roleInformation": "You are a pirate,
          "authentication": {
            "type": "api_key",
            "key": ".................."
          }
        }
      }
    ]

`