Recommending a Product
๐๏ธ Quickstart Guide - Recommending a Productโ
Learn how to integrate CrewAI with Fiscus SDK and Crew in under 5 minutes to recommend products using an AI-powered chatbot.
How to Use the Fiscus SDKโ
Turn natural language into powerful API operations in minutes. Follow these 5 steps to create an AI-powered product recommendation chatbot using the Fiscus SDK and Crew.
What youโll achieve: By the end of this guide, youโll have an AI agent capable of recommending a product to a customer through a chatbot.
- Python
1. Install Fiscus SDKโ
Install Packages
pip install fiscus crewai
2. Connect Your Chatbot API (e.g., Twilio, Intercom)โ
Quickly integrate with a chatbot API
from fiscus import FiscusClient, FiscusUser
# Initialize the Fiscus client with your API key and user_id
client = FiscusClient(api_key='YOUR_FISCUS_API_KEY', user_id='user_123')
# Add the chatbot connector (e.g., Intercom)
client.user.add_connector('Intercom')
# If the connector requires authentication, this will trigger an authentication flow
client.user.authenticate_connector('Intercom')
3. Initialize OpenAIโ
Set up your LLM or Agent.
from openai import OpenAI
# Initialize OpenAI
language_model = OpenAI(api_key='YOUR_OPENAI_API_KEY')
4. Define a Task and Generate a Product Recommendationโ
Using natural language, letโs ask OpenAI to recommend a product.
from crewai import Agent, Task, Crew
# Define a custom Fiscus Agent that uses OpenAI to handle user input
class FiscusAgent(Agent):
def execute(self, task):
user_input = task.description
# Use Fiscus SDK's ai_execute to process the natural language input
response = client.ai_execute(input=user_input, user=user)
return response.result
# Initialize the agent
agent = FiscusAgent(name='FiscusAgent')
# Define a task asking for a product recommendation
task = Task(
description='Recommend a product for a customer who is interested in fitness.',
agent=agent
)
# Initialize Crew and run the task to get the recommendation
crew = Crew(agents=[agent], tasks=[task])
result = crew.run()
print(result)
5. Send the Recommendation to the Customerโ
Now, letโs send the recommendation back to the customer via the chatbot:
# Assuming the AI response contains the product recommendation
recommended_product = result
# Execute the action using the Fiscus SDK to send the recommendation
send_result = client.execute(
connector_name='Intercom',
operation='send_message',
params={
'recipient_id': 'customer_123',
'message': f'Recommended product: {recommended_product}'
}
)
print(send_result)s
ย
Look at That! ๐
Success! Youโve now:
๐ Authenticated your chatbot API account with Fiscus SDK
๐ค Used OpenAI to generate a personalized product recommendation
๐ค Sent a product recommendation to your customer through the chatbot
โ
Successfully executed the recommendation flow using AI and Fiscus SDK