Closed kurianbenoy closed 5 months ago
Hey @kurianbenoy sorry that doc is out of date. I will get it updated. Please see the api docs for up to date snippets! classify should look like:
import cohere
from cohere import ClassifyExample
co = cohere.Client('<<apiKey>>')
examples=[
ClassifyExample(text="Dermatologists don't like her!", label="Spam"),
ClassifyExample(text="'Hello, open to this?'", label="Spam"),
ClassifyExample(text="I need help please wire me $1000 right now", label="Spam"),
ClassifyExample(text="Nice to know you ;)", label="Spam"),
ClassifyExample(text="Please help me?", label="Spam"),
ClassifyExample(text="Your parcel will be delivered today", label="Not spam"),
ClassifyExample(text="Review changes to our Terms and Conditions", label="Not spam"),
ClassifyExample(text="Weekly sync notes", label="Not spam"),
ClassifyExample(text="'Re: Follow up from today's meeting'", label="Not spam"),
ClassifyExample(text="Pre-read for tomorrow", label="Not spam"),
]
inputs=[
"Confirm your email address",
"hey i need u to send some $",
]
response = co.classify(
inputs=inputs,
examples=examples,
)
print(response)
Thanks, this helped!
Documentation for Intent classification: https://docs.cohere.com/reference/intent-recognition
Input Import:
Error:
Cohere API Responses is not coming correctly. I am using the
cohere verison: 5.2.2