Skip to main content

No project description provided

Project description

Ionic Langchain

Ionic Langchain provides a wrapper around the Ionic Commerce's SDK for use as a Tool in a custom Langchain 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.

Installation

This tool requires at least langchain@0.0.350 and can work with any greater patch release the 0.0.x series.

We currently support python 3.8.10 and above, but if you need support for a lower version, please open an issue and we will add support.

You can install the package from PyPI using pip:

python3 -m pip install ionic-langchain

or poetry:

poetry add ionic-langchain

Usage

import os
from typing import List

from ionic_langchain.tool import IonicTool
from langchain.agents import AgentType, Tool
from langchain.agents import initialize_agent
from langchain.chat_models import ChatOpenAI

tools =  [
    IonicTool().tool(),
    # your other tools,
]

agent = initialize_agent(
    tools=tools,
    llm=ChatOpenAI(openai_api_key="your_key_here", temperature=0.7),
    agent=AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION,
    handle_parsing_errors=True,
    verbose=True,
)


input = "Where can I get tide pods"

agent.run(input=input)

Please see the langchain agent docs for more details on how to build and run agents

Customizing the SDK

ionic_langchain.tool.IonicTool's constructor accepts an instance of ionic_langchain.tool.Ionic, a wrapper around our SDK. ionic_langchain.tool.Ionic, in turn accepts an instance of that SDK, so you can provide the tool with a custom configuration:

import os
from ionic.sdk import Ionic as IonicSDK
from ionic_langchain.tool import Ionic, IonicTool


sdk = IonicSDK(api_key_header=os.environ.get("IONIC_API_KEY"))
ionic = Ionic(sdk=sdk)
tool = IonicTool(ionic=ionic).tool()

Development

Coming soon. Please feel free to open an issue.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ionic_langchain-0.2.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ionic_langchain-0.2.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file ionic_langchain-0.2.2.tar.gz.

File metadata

  • Download URL: ionic_langchain-0.2.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.8.12 Linux/6.2.0-1018-azure

File hashes

Hashes for ionic_langchain-0.2.2.tar.gz
Algorithm Hash digest
SHA256 267b0d5a3acbbc206c86bf223be84b836b77a7a8163712e0d3d0f5ef3ba02e60
MD5 9b1e2179a15cdd82dbbb7b8da46bc646
BLAKE2b-256 afee7a91ad6ef4781646053ffe9a71234e879eaa898e5ed6b73a7fed1fbd6eeb

See more details on using hashes here.

File details

Details for the file ionic_langchain-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: ionic_langchain-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.8.12 Linux/6.2.0-1018-azure

File hashes

Hashes for ionic_langchain-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 984d0c77b97d46152086194e9f0cb89d62e9199f3ec4b2dffcb20e2a88900630
MD5 3c72f36fe24e10090c39197cd11f7b6b
BLAKE2b-256 48490beaa04ca6a97d9687e0b87297d225adac90afd713749ac7dc72571aaeb6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page