UiPath Cognitive Service Activities Tutorial

if I try MS text analyser as HTTP request with the same API key I get the right response:

The services url I use is: https://westcentralus.api.cognitive.microsoft.com/text/analytics/v2.0

How are you able to see which services url is passed in the Microsoft text analysis activity in studio?

2 Likes

yes… service url is correct…

2 Likes

Hi @nbjerke

Which version of cognitive package do you use?
There is a ServiceUrl property in the latest version (1.0.6479.13212)

You can fill “https://westcentralus.api.cognitive.microsoft.com/text/analytics/v2.0/” into this property.
Please notice that you need to add ‘/’ at the end of the URL string.

Regards,

14 Likes

That did the trick! Thank you @Yoichi

Make sure you update the activity people :smiley:

2 Likes

can you explain step by step throw an error of object null reference

2 Likes

Hi,
@Teodor_Hoaghea:
I am using your workflow and tried to initialize the variable “Key Phrase”. Sharing the updated .xmal file.Main.xaml (12.7 KB)Cognitive_1.zip (9.6 KB)

But still getting the error error

Hi @sain87 ,

Your workflow works in my environment.
Probably you have a problem with your API setting.
Can you share your RawResult in Microsoft Text Analysis Activity with us?

Regards,

Hi Yoichi,

you are correct ,

I am getting this as RawResult. Although I am providing the key from my Azure account.
Do you have any Idea.

The Raw Result is : { “statusCode”: 401, “message”: “Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription.” }
{ “statusCode”: 401, “message”: “Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription.” }

Hi @sain87 ,

401 means wrong subscription key or wrong location.

First please check your location in the Azure Portal.
Then, check if your key is valid in the following page.

West Central US
https://westcentralus.dev.cognitive.microsoft.com/docs/services/TextAnalytics.V2.0/operations/56f30ceeeda5650db055a3c7/console

You may need to regenerate your API key in the Azure Portal, if the response code is 401 in the page,

If your location is not West Central US, please choose your location from the following page.
https://westus.dev.cognitive.microsoft.com/docs/services/TextAnalytics.V2.0/operations/56f30ceeeda5650db055a3c7

Regards,

4 Likes

Hi @Yoichi
Thanks a Lot. It’s working now.

1 Like

Hi,

I am also getting the same error. Could you please explain how did you remove this error.

Thanks.

Hey All… I created a Google vision API Key for OCR activities via Google Cloud OCR but it’s showing a compilation error saying that the Key is not declared and it may be inaccessible due to it’s protection level. But I haven’t restricted the key to any applications. Is there some specific expression to insert the API_KEY?

Hi,

I am trying to integrate a python script to perform a sentiment analysis on the product reviews. I am getting a below error while executing. I could run other python scripts from UI path without any issues. I have been stuck with this last two days. Any help would be greatly appreciated. Thanks

An error has occured

Source: Newtonsoft.Json

Message: Error resolving type specified in JSON ‘Python.Runtime.PythonException, Python.Runtime’. Path ‘$type’, line 1, position 462.

Exception Type: JsonSerializationException

Newtonsoft.Json.JsonSerializationException: Error resolving type specified in JSON ‘Python.Runtime.PythonException, Python.Runtime’. Path ‘$type’, line 1, position 462. —> Newtonsoft.Json.JsonSerializationException: Could not load assembly ‘Python.Runtime’.
at Newtonsoft.Json.Serialization.DefaultSerializationBinder.GetTypeFromTypeNameKey(TypeNameKey typeNameKey)
at Newtonsoft.Json.Utilities.ThreadSafeStore2.AddValue(TKey key) at Newtonsoft.Json.Utilities.ThreadSafeStore2.Get(TKey key)
at Newtonsoft.Json.Serialization.DefaultSerializationBinder.BindToType(String assemblyName, String typeName)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolveTypeName(JsonReader reader, Type& objectType, JsonContract& contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, String qualifiedTypeName)
— End of inner exception stack trace —
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolveTypeName(JsonReader reader, Type& objectType, JsonContract& contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, String qualifiedTypeName)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadMetadataProperties(JsonReader reader, Type& objectType, JsonContract& contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue, Object& newValue, String& id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateISerializableItem(JToken token, Type type, JsonISerializableContract contract, JsonProperty member)
at Newtonsoft.Json.Serialization.JsonFormatterConverter.Convert(Object value, Type type)
at System.Runtime.Serialization.SerializationInfo.GetValue(String name, Type type)
at System.Exception…ctor(SerializationInfo info, StreamingContext context)
at Void .ctor(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)(Object )
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateISerializable(JsonReader reader, JsonISerializableContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateISerializableItem(JToken token, Type type, JsonISerializableContract contract, JsonProperty member)
at Newtonsoft.Json.Serialization.JsonFormatterConverter.Convert(Object value, Type type)
at System.Runtime.Serialization.SerializationInfo.GetValue(String name, Type type)
at System.Exception…ctor(SerializationInfo info, StreamingContext context)
at System.AggregateException…ctor(SerializationInfo info, StreamingContext context)
at Void .ctor(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)(Object )
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateISerializable(JsonReader reader, JsonISerializableContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at UiPath.Shared.JsonParser.DeserializeObject[T](String jsonValue)
at UiPath.Models.UiPathDuplexProxy.<>c__DisplayClass18_0.b__0()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

Hello,
@nbjerke
showing error before keyphrase list for each
Error: Object reference not set to an instance of an object. This error usually occurs when using a variable with no set value (not initialized)

Thanks. Your trick solved my prob!

Can anyone share an example of Stanford CoreNLP activities? I want to know how they can be used as I always get Compiler error.

1 Like

You will need Stanford server Instance in order to run those activities.

Installation Steps:

  1. Download Stanford NLP
    Download - CoreNLP

  2. Download Java 8
    https://www.java.com/en/download/

  3. Increase Java heap space in Environment Variables

image

  1. Add Java and Stanford class paths in Environment Variables.

image

Commands (CD Stanford Library Path):

Initialize Server in Command Prompt (Create a bat for easier use)

java -cp “*” -Xmx4g edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000 -username username -password password

Server URL: http://localhost:9000

Sample :

NLP_sample.xaml (12.9 KB)

4 Likes

Hi,
I tried to run the same code but it is showing an error “Object reference not set to an instance of an object”.
Please suggest me where I have to change the code as of now I am getting a message to give an object reference inside For each loop.

Regards,
Asmit