How to Create a Customer Profile with IBM Watson - Part 2 - Watson Personality Insights
HTML-код
- Опубликовано: 11 сен 2024
- Setup is done and dusted. It’s time to generate some profiles!
In this video I’ll run through how to generate a customer (or any other human) profile from a block of text using IBM Watson Personality Insights. This whole tutorial will take you from blank slate to getting results that showcase the API’s awesome features. You’ll be able to analyse customer needs, values and their personality….all from a block of text.
Want to follow along with the blog post? Check it out here: www.nicholasre...
Want more awesome data and analytics stuff?? Follow me on…
Blog: www.nicholasrenotte.com
Twitter: / nicholasrenotte
Facebook: / nickrenotte
Hey everyone, there's two key changes that have come out that require some code tweaks. Nothing major.
First, when importing the Personality Insights Service replace watson_developer_cloud with ibm_watson like so:
Before:
from watson_developer_cloud import PersonalityInsightsV3
After:
from ibm_watson import PersonalityInsightsV3
Second, the new package requires you to set a new parameter which specifies the response type as JSON. So, these are the changes required when requesting a profile.
Before:
profile = service.profile(f.read(), content_type='text/plain',).get_result()
After:
profile = service.profile(f.read(), accept='application/json').get_result()
The blog post has been updated to reflect those changes: www.nicholasrenotte.com/how-to-develop-customer-profiles-using-ibm-watson-personality-insights/
Happy coding!!
Not working with the changes
Heya @@cristinacruzcortes59 can you share any errors you're getting?
Nicholas Renotte my mistake, working perfect
Hi Nicholas!
I have been trying this for myself, and also took the deprecations to account. However, I am facing an error that I can't figure out why.
ApiException: Error: Provided API key could not be found, Code: 400
I have generated my own API key through IBM's IAM authentication page. My first API key showed a forbidden error code 403. Then I created another API key and tried that, which then showed the error code 400 again.
Now when I try either key, I get the error code 400.
Amazing video anyways! Hope you do well.
UPDATE: I have watched Part1 of this series and it turns out I never created a Service Credential. This solved my problem. It works wonderfully now. You are amazing! Thanks a LOT!
AWESOME @Faiyaz Murshed, glad you got it working!
Question. IBM Watson Personality Insights has been 'discontinued', have you come across any alternatives?
Not as of yet unfortunately @Tay M, will let you know once I find one!
@@NicholasRenotte Please, let me know too. I'm very interested in this topic and your tutorials are great.
Hi! i got an error on connecting to watson_developer_cloud on the code.. it says it doesn't recognise that command. Are you sure is the way to connect?
The watson_developer_cloud module is being deprecated. Try this:
1. First install the new watson library:
pip install ibm-watson
2. Then in your notebook, import the new library and continue with the rest of the code:
from ibm_watson import
.... continue with regular code
PersonalityServiceV3
service = PersonalityInsightsV3(url=url, version='2017-10-13', iam_apikey=apikey)
@@NicholasRenotte Thank you so much for your reply! I will try your suggestion and let you know if it worked. Thank you! By the way do you know any tutorial on how to connect Personality Insights to Watson Conversation? Thanks!
hi, i am getting error for PersonalityInsightsV3, when i am accessing it through service. Its telling me, PersonalityInsightsV3 is deprecated, ans watson-developer-cloud moved to ibm-watson. Please tell me what do i do, i stuck on this step: service = PersonalityInsightsV3(url=url, version='2017-10-13', iam_apikey=apikey)
Just worked out what this is, it looks like the watson_developer_cloud module is being deprecated. Try this code instead:
At the terminal:
pip install ibm-watson
In your notebook:
from ibm_watson import PersonalityServiceV3
service = PersonalityInsightsV3(url=url, version='2017-10-13', iam_apikey=apikey)
@@NicholasRenotte thank you for reply. this worked.
But now i am getting error at :
profile = service.profile(text, content_type='text/plain').get_result()
its giving me error:
TypeError: profile() missing 1 required positional argument: 'accept'
what do i do?
I also tried file uploading method also, thats not working either.
myfile = open(r'C:\Users\Home\AppData\Local\Programs\Python\Python37\Scripts\profile.txt')
----> 2 profile = service.profile(myfile.read(), content_type='text/plain',).get_result()
TypeError: profile() missing 1 required positional argument: 'accept'
same for file upload method
@@ashwinikanase3664 Same issue here.
@@ashwinikanase3664 this is a recent change, remove content_type='text/plain' and change it to accept='application/json'
@@NicholasRenotte hey hi
recently i am updating my this script.
and tried to run.
now its giving me error on service
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in
----> 1 service = PersonalityInsightsV3(url='url', version='2017-10-13', iam_apikey='apikey')
TypeError: __init__() got an unexpected keyword argument 'url'
what do i do now?
Thanks a lot for your tutorial. I am just stuck on one thing. I am sure my API key is correct, same as the url.
NameError Traceback (most recent call last)
in
----> 1 service = PersonalityInsightsv3(url=url, version='2017-10-13', iam_apikey=apikey)
NameError: name 'PersonalityInsightsv3' is not defined
Is there anyone who can help me out?
Hey there! Looks like you might not have imported the library. Try adding this line before you create the service:
from ibm_watson import PersonalityInsightsv3
Nicholas Renotte Thanks, Im going to check it out right away.
Can we use this on LinkedIn profiles?
You sure can, looks like you can use the LinkedIn articles API to grab text. Check this out: docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/articles-api
Hi! I am working about connecting with personality insights although the last message was in image classifier.
when i type the input 6 (service = ....) I see this message:
/Users/eduardtevi/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:1: DeprecationWarning: PersonalityInsightsV3 is a deprecated function. watson-developer-cloud moved to ibm-watson
"""Entry point for launching an IPython kernel.
Do you know which is the non deprecated function?
Thanks in advance.
Just worked out what this is, it looks like the watson_developer_cloud module is being deprecated. Try this code instead:
At the terminal:
pip install ibm-watson
In your notebook:
from ibm_watson import PersonalityServiceV3
service = PersonalityInsightsV3(url=url, version='2017-10-13', iam_apikey=apikey)
Thank you very much!@@NicholasRenotte I see there's something still wrong. I will try to fight it this week.
@@eduU13 Hey there, looks like there were some changes to the Python package. I've updated the blog post and run through the code myself this morning! Should all work now. Happy coding :)
Has anyone got this to work since updates came out?
Hey Sam, working on the updates as we speak!
@@NicholasRenotte Amazing
@@NicholasRenotte Seems to have to deal with the header types?
@@SamRomain still digging into it atm. Pretty sure it's just an update to the python SDK, shouldn't be too bad to get up and running. Worst case scenario I'll write up how to hit the API directly using requests.
Hey Sam, try changing the content_type parameter and instead pass this to the profile method: accept='application/json'. Blog post is updated to show the changes! www.nicholasrenotte.com/how-to-develop-customer-profiles-using-ibm-watson-personality-insights/