Guides
Haystack v1
Guide for integrating Ionic using Haystack v1
Ionic Haystack
Ionic Haystack Tool
Ionic Haystack provides a wrapper around the Ionic Commerce’s SDK for use as a Tool in a Haystack v1 agent. This tool will enable e-commerce for your agent, allowing your users to ask for product recommendations and purchase products through the agent chat interface.
Jupyter Notebook
Basic example integrating Ionic using Haystack
Installation
pip install farm-haystack[colab]
pip install ionic-haystack
Usage
from haystack.agents import Tool
from haystack.agents.conversational import ConversationalAgent
from haystack.agents.memory import ConversationMemory
from haystack.nodes import PromptNode
from ionic_haystack.prompt_templates import ionic_template
from ionic_haystack.tool import IonicShoppingTool
ionic_node = IonicShoppingTool()
ionic_tool = Tool(
name="Ionic",
pipeline_or_node=ionic_node,
description=ionic_template
)
memory = ConversationMemory()
prompt_node = PromptNode("gpt-3.5-turbo", api_key=openai_api_key, max_length=256, stop_words=["Observation:"])
agent = ConversationalAgent(prompt_node, tools=[ionic_tool], memory=memory, prompt_template="deepset/conversational-agent")
Ionic API Key
Instantiate the IonicShoppingTool passing the api_key
as a parameter.
IonicShoppingTool(api_key="<Your Ionic API Key>")
Was this page helpful?