LangChain StackSpot AI
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.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Metadata
Release files for langchain-stackspot-ai 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_stackspot_ai-0.0.1.tar.gz | 16.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_stackspot_ai-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.2 kB
Release files / langchain_stackspot_ai-0.0.1.tar.gz
| Download URL | langchain_stackspot_ai-0.0.1.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ffacf4ce46684ed1b8ce2ca03aecf7c219c7eb74ecc6efb8ec200e44710b159
|
|
BLAKE2b-256 checksum How to use checksums |
9270dfec71509760743afe840733e6014729f6951d98a9b381b32d79181e98a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.9.10 Darwin/24.3.0
|
Release files / langchain_stackspot_ai-0.0.1-py3-none-any.whl
| Download URL | langchain_stackspot_ai-0.0.1-py3-none-any.whl |
|---|---|
| Size | 19.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1847b350963b33eda8f8fc3e74f333214cfa77523cd053d5ed0a97003b6668a0
|
|
BLAKE2b-256 checksum How to use checksums |
8ab5133e89357ced123570645590191db19a61893ee6ae99043de552036cde93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.9.10 Darwin/24.3.0
|