Giter Site home page Giter Site logo

Comments (8)

itye-msft avatar itye-msft commented on August 22, 2024

Hi @bs-oke

Since you are using cognitive service and LUIS, you need to add the following keys to your web.config:

    <!-- LUIS credentials-->
    <add key="LuisModelId" value="your LUIS model URL" />
    <add key="LuisSubscriptionKey" value="subscription key" />
    
    <!-- Text Analytics data for message sentiment analysis -->
    <add key="TextAnalyticsApiKey" value="text analytics api key" />
    <add key="TextAnalyticsMinLength" value="3" />
    <add key="CognitiveServiceApiEndpoint" value="https://westus.api.cognitive.microsoft.com/"/>
  • TextAnalyticsApiKey. To track sentiment analysis, the telemetry code calls the Text Analytics API, you can obtain this key from the Azure Portal. The bot won't log any sentiment data if this value is empty.
  • TextAnalyticsMinLength. You normally don't want to track sentiment for short phrases like "yes", "no", etc. In the example above, this parameter tells the logger to only track sentiment for messages that have 3 words or more.
  • 'CognitiveServiceApiEndpoint' allows you to set the correct region for cognitive services.
    This is the key you should probably edit.

Let me know if it helped.
Thanks
Itye

from botbuilder-instrumentation-cs.

bs-oke avatar bs-oke commented on August 22, 2024

Hi @itye-msft

Thanks for your replay.

I have it in my config:

    <!-- Text Analytics data for message sentiment analysis -->
    <add key="TextAnalyticsApiKey" value= <proper key is here> />
    <add key="TextAnalyticsMinLenght" value="3" />
    <add key="CognitiveServiceApiEndpoint" value="https://westeurope.api.cognitive.microsoft.com/" />

And it doesn't help.

Kind regards
Bartek

from botbuilder-instrumentation-cs.

itye-msft avatar itye-msft commented on August 22, 2024

@bs-oke
Are you instantiating the instrumentation using the built in dependency resolver, or using your custom code?
The provided dependency resolver in this code sample is the only place where the we read the confing file. It means, that if you are using your own code, you should make sure to correctly instantiate SentimentManager.

The code does not contain any hard coded URLs such as the one that appears in your error. Everything it being called from the config file. Can you verify it by debugging it?

from botbuilder-instrumentation-cs.

bs-oke avatar bs-oke commented on August 22, 2024

@itye-msft
I have copied solution from your Bot-with-instrumentation-cs example so I use InstrumentationHelper class and instantiate the instrumentation from HandleSystemMessage.

When I stop at await InstrumentationHelper.DefaultInstrumentation.TrackActivity(message); in MessageController.HandleSystemMessage I have a proper _cognitiveServiceApiEndpoint (https://westeurope.api.cognitive.microsoft.com/). But when I say something to a bot and stop in public RootDialog() I have wrong endpoint in services-model-UriBase (westus.api.cognitive.microsoft.com) and in the next step I get exception in 'MessageController.Post' (Response status code does not indicate success: 401 (Access Denied).).

For LUIS credentials I use Id and key from Endpoint Url which work fine outside the bot. For TextAnalyticsApiKey I use one of LUIS' Keys taken from Azure (hope it's ok).

from botbuilder-instrumentation-cs.

itye-msft avatar itye-msft commented on August 22, 2024

@bs-oke
I have verified that none of the repos contains westus.api.cognitive.microsoft.com string.
Can you please attach your complete code? I will try to debug it with the sources directly.
Otherwise, based on what you wrote it should have worked, and the only way I can suggest to nail the problem is by debugging it.

Thanks
Itye

from botbuilder-instrumentation-cs.

bs-oke avatar bs-oke commented on August 22, 2024

@itye-msft
OK, thanks, but I'm not sure if I want to publish my code with all credentials. Is there any way to send it directly to you?

from botbuilder-instrumentation-cs.

itye-msft avatar itye-msft commented on August 22, 2024

@bs-oke please post your code, and omit your credentials and sensitive data.

from botbuilder-instrumentation-cs.

bs-oke avatar bs-oke commented on August 22, 2024

Because problem was solved outside this issue tracking (thanks @itye-msft!) I'm showing only what's changed to make things work (according to changes made in BotBuilder Instrumentation):

Web.config

LuisDomain added

    <!-- LUIS credentials-->
    <add key="LuisModelId" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
    <add key="LuisSubscriptionKey" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
    <add key="LuisDomain" value="westeurope.api.cognitive.microsoft.com" />

RootDialog.cs

LuisDomain added

        public RootDialog() : 
            base(ConfigurationManager.AppSettings["LuisModelId"], 
                ConfigurationManager.AppSettings["LuisSubscriptionKey"], 
                ConfigurationManager.AppSettings["LuisDomain"])
        {
        }

from botbuilder-instrumentation-cs.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.