Skip to main content

Subtotal AI Toolkit

Project description

Subtotal AI Toolkit - Python

The Subtotal AI Toolkit library enables popular agent frameworks including LangChain and CrewAI to integrate with the Subtotal API through function calling. The library is not exhaustive of the entire Subtotal API.

Installation

You don't need this source code unless you want to modify the package. If you just want to use the package, just run:

pip install subtotal-ai-toolkit

You can specify the specific optional dependencies you need if you'd like them to be installed by this package. For example, if you intend on using the OpenAI integration, you can run:

pip install subtotal-ai-toolkit[openai]

Optional dependencies include:

  • openai
  • langchain
  • crewai

If you'd like to only install all optional dependencies, you can run:

pip install subtotal-ai-toolkit[all]

Requirements

  • Python 3.11+

Usage

The library needs to be configured with your account's secret API key which is available in your Subtotal Dashboard.

from subtotal_ai_toolkit.crewai.toolkit import SubtotalAIToolkit
from subtotal_ai_toolkit.configuration import Configuration, Tools

subtotal_toolkit = SubtotalAIToolkit(
    secret_key="YOUR_SECRET_KEY",
    configuration=Configuration(tools=[Tools.ALL])
)

NOTE: The toolkit works with LangChain, CrewAI, and OpenAI. The above example is for CrewAI. Use the correct import depending on which framework you're using.

# CrewAI
from subtotal_ai_toolkit.crewai.toolkit import SubtotalAIToolkit

# LangChain
from subtotal_ai_toolkit.langchain.toolkit import SubtotalAIToolkit

# OpenAI
from subtotal_ai_toolkit.openai.toolkit import SubtotalAIToolkit

The toolkit can be passed as a list of tools. For example (using CrewAI):

from crewai import Agent, Task, Crew

subtotal_agent = Agent(
    role="Subtotal Agent",
    goal="Integrate with the Subtotal API effectively to support our business.",
    backstory="You have been using the Subtotal API for a long time.",
    tools=[*subtotal_ai_toolkit.get_tools()],
    allow_delegation=False,
    verbose=True,
)

get_merchants = Task(
    description="Get the list of merchants supported by the Subtotal API.",
    expected_output="merchants",
    agent=subtotal_agent,
)

crew = Crew(
    agents=[subtotal_agent],
    tasks=[get_merchants],
    verbose=True,
    planning=True,
)

crew.kickoff()

Examples for LangChain, CrewAI, and OpenAI are included in the examples directory.

Development

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

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

subtotal_ai_toolkit-0.2.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

subtotal_ai_toolkit-0.2.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file subtotal_ai_toolkit-0.2.0.tar.gz.

File metadata

  • Download URL: subtotal_ai_toolkit-0.2.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for subtotal_ai_toolkit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 80ff787ab3a19f86ec6991ae8219f45588041dc34d6e3e352728dff8089c1b4e
MD5 63c10266bfae38398447b7a58ac435d8
BLAKE2b-256 c9282344d75f146871cb8ec9ae91842cc372a155b793a693f61ac2f740a245d9

See more details on using hashes here.

File details

Details for the file subtotal_ai_toolkit-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for subtotal_ai_toolkit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d8719579fddf26d98e16d9af36334890dcb57605b430ae08037681f5ce8c93d
MD5 ef03ec23c1ca56b2277e7a80e2e3a25d
BLAKE2b-256 183ce9130b04529d859283f6ede0139836ed26407b48207fad4ca00333f5d39e

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