An integration package connecting Salesforce and LangChain
Project description
langchain-salesforce
This package contains the LangChain integration with Salesforce, providing tools to interact with Salesforce CRM data using LangChain's framework.
Features
- Salesforce CRM integration with LangChain
- SOQL query execution
- Object schema inspection
- CRUD operations on Salesforce objects
- Comprehensive error handling
Installation
pip install -U langchain-salesforce
Configuration
Configure your Salesforce credentials by setting the following environment variables:
SALESFORCE_USERNAME
- Your Salesforce usernameSALESFORCE_PASSWORD
- Your Salesforce passwordSALESFORCE_SECURITY_TOKEN
- Your Salesforce security tokenSALESFORCE_DOMAIN
- Your Salesforce domain (defaults to "login", use "test" for sandbox)
Usage
The SalesforceTool
class provides a comprehensive interface to interact with Salesforce CRM:
from langchain_salesforce import SalesforceTool
# Initialize the tool
tool = SalesforceTool(
username="your-username",
password="your-password",
security_token="your-security-token",
domain="login" # or "test" for sandbox
)
# Query contacts
result = tool.run({
"operation": "query",
"query": "SELECT Id, Name, Email FROM Contact LIMIT 5"
})
# Get object schema
schema = tool.run({
"operation": "describe",
"object_name": "Account"
})
# Create new contact
new_contact = tool.run({
"operation": "create",
"object_name": "Contact",
"record_data": {"LastName": "Smith", "Email": "smith@example.com"}
})
# Update a contact
updated_contact = tool.run({
"operation": "update",
"object_name": "Contact",
"record_id": "003XXXXXXXXXXXXXXX",
"record_data": {"Email": "new.email@example.com"}
})
# Delete a contact
delete_result = tool.run({
"operation": "delete",
"object_name": "Contact",
"record_id": "003XXXXXXXXXXXXXXX"
})
# List available objects
objects = tool.run({
"operation": "list_objects"
})
Supported Operations
query
: Execute SOQL queriesdescribe
: Get object schema informationlist_objects
: List available Salesforce objectscreate
: Create new recordsupdate
: Update existing recordsdelete
: Delete records
Development
To contribute to this project:
- Clone the repository
- Install dependencies with Poetry:
poetry install
- Run tests:
make test
- Run linting:
make lint
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
Built Distribution
File details
Details for the file langchain_salesforce-0.1.1.tar.gz
.
File metadata
- Download URL: langchain_salesforce-0.1.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.5 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
77229814582117607b3f59c7927d0f2faf87bea999536eab1bac8dffe95cbfd3
|
|
MD5 |
b0ec7cc0f46c7a2182aa6477b0fc8093
|
|
BLAKE2b-256 |
813139db0ac8e998ceced0d8ef4887a529946dded75e4dd48e5ade11c0191d8b
|
File details
Details for the file langchain_salesforce-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: langchain_salesforce-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.5 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
5ead61d10914adf5006eb3bc507a23c046e6d3f0b2dd81395b27c667f4ba4cb2
|
|
MD5 |
3c434ef1865511901c878ca04a9b6df9
|
|
BLAKE2b-256 |
19ab7c873cce0118a6174b6f1ea1efb534bf367515bfb1cab4fb41691c527101
|