Skip to main content

A library for integrating StackSpot AI with LangChain

Project description

LangChain StackSpot AI

PyPI version Python Version License: MIT Documentation Status

A Python library for seamless integration between StackSpot AI and LangChain, enabling developers to leverage StackSpot AI's capabilities within the LangChain ecosystem.

Features

  • Easy-to-use StackSpot AI chat model implementation for LangChain
  • Function calling support with StackSpot AI
  • Agent executors that work with StackSpot AI
  • Adapters for converting between LangChain and StackSpot AI formats
  • Comprehensive documentation and examples

Installation

From PyPI

pip install langchain-stackspot-ai

Using Poetry

poetry add langchain-stackspot-ai

Quick Start

from langchain_stackspot_ai.models import ChatStackSpotAI
from langchain_core.messages import HumanMessage, SystemMessage

# Initialize the StackSpot AI chat model
chat = ChatStackSpotAI(
    client_id="your-client-id",
    client_secret="your-client-secret",
    slug="your-slug"
)

# Use the model
messages = [
    SystemMessage(content="You are a helpful assistant."),
    HumanMessage(content="What is LangChain?")
]

response = chat.invoke(messages)
print(response.content)

Using with Tools and Agents

from langchain_stackspot_ai.models import ChatStackSpotAI
from langchain_stackspot_ai.agents import create_stackspot_agent_executor
from langchain_core.tools import Tool

# Define tools
tools = [
    Tool(
        name="search",
        func=lambda query: f"Search results for: {query}",
        description="Search the web for information."
    )
]

# Initialize the StackSpot AI chat model
chat = ChatStackSpotAI(
    client_id="your-client-id",
    client_secret="your-client-secret",
    slug="your-slug"
)

# Create an agent executor
agent_executor = create_stackspot_agent_executor(
    llm=chat,
    tools=tools,
    system_message="You are a helpful assistant with access to tools."
)

# Use the agent
result = agent_executor.invoke({"input": "What's the weather in New York?"})
print(result["output"])

Documentation

For detailed documentation, visit https://langchain-stackspot-ai.readthedocs.io.

Development

This project uses Poetry for dependency management and packaging.

Setting up the development environment

# Clone the repository
git clone https://github.com/stackspot/langchain-stackspot-ai.git
cd langchain-stackspot-ai

# Install dependencies
poetry install

# Activate the virtual environment
poetry shell

Running tests

pytest

Code quality

# Format code
black langchain_stackspot_ai tests

# Sort imports
isort langchain_stackspot_ai tests

# Type checking
mypy langchain_stackspot_ai

# Linting
flake8 langchain_stackspot_ai tests

Building documentation

cd docs
make html

Publishing to PyPI

Test PyPI

poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish --build --repository testpypi

Production PyPI

poetry publish --build

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

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

langchain_stackspot_ai-0.0.1.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

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

langchain_stackspot_ai-0.0.1-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file langchain_stackspot_ai-0.0.1.tar.gz.

File metadata

  • Download URL: langchain_stackspot_ai-0.0.1.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.9.10 Darwin/24.3.0

File hashes

Hashes for langchain_stackspot_ai-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7ffacf4ce46684ed1b8ce2ca03aecf7c219c7eb74ecc6efb8ec200e44710b159
MD5 1101d8e2496e95855f9609560c15e968
BLAKE2b-256 9270dfec71509760743afe840733e6014729f6951d98a9b381b32d79181e98a0

See more details on using hashes here.

File details

Details for the file langchain_stackspot_ai-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_stackspot_ai-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1847b350963b33eda8f8fc3e74f333214cfa77523cd053d5ed0a97003b6668a0
MD5 40f553e029f6f52f8acfae47179fd0b5
BLAKE2b-256 8ab5133e89357ced123570645590191db19a61893ee6ae99043de552036cde93

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