
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
heroku-langchain-aisdk
Advanced tools
A Python SDK for Heroku's Managed Inference API (MIA), providing easy access to AI models through a LangChain-compatible interface.
A Python SDK for Heroku's Managed Inference API (MIA), providing easy access to AI models through a LangChain-compatible interface.
pip install heroku-langchain-aisdk
import os
from heroku_mia_sdk import HerokuMia
# Set your environment variables
os.environ["HEROKU_API_KEY"] = "your-api-key"
os.environ["INFERENCE_MODEL_ID"] = "claude-3-7-sonnet"
os.environ["INFERENCE_URL"] = "https://us.inference.heroku.com"
# Create client and send message
client = HerokuMia()
response = client.invoke("What is the capital of France?")
print(response.content)
Variable | Description | Required |
---|---|---|
HEROKU_API_KEY | Your Heroku API key | Yes |
INFERENCE_MODEL_ID | Model to use (e.g., claude-3-7-sonnet ) | Yes |
INFERENCE_URL | Inference endpoint URL | Yes |
inf-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
from heroku_mia_sdk import HerokuMia
client = HerokuMia()
response = client.invoke("Hello, how are you?")
print(response.content)
from heroku_mia_sdk import HerokuMia
client = HerokuMia()
for chunk in client.stream("Tell me a story"):
print(chunk.content, end="", flush=True)
from heroku_mia_sdk import HerokuMia
from langchain_core.tools import tool
@tool
def get_weather(city: str) -> str:
"""Get weather for a city."""
return f"The weather in {city} is sunny and 25°C"
client = HerokuMia()
client = client.bind_tools([get_weather])
response = client.invoke("What's the weather in Paris?")
from heroku_mia_sdk import HerokuMia
from langchain_core.messages import HumanMessage, SystemMessage
client = HerokuMia()
messages = [
SystemMessage(content="You are a helpful assistant."),
HumanMessage(content="What is Python?")
]
response = client.invoke(messages)
print(response.content)
git clone https://github.com/heroku/heroku-langchain-aisdk
cd heroku-langchain-aisdk/python
pip install -e .
# Set environment variables
export HEROKU_API_KEY="your-api-key"
export INFERENCE_MODEL_ID="claude-3-7-sonnet"
export INFERENCE_URL="https://us.inference.heroku.com"
# Run examples
python examples/example_chat_basic.py
python examples/example_chat_streaming.py
python examples/example_chat_tools.py
pip install -e ".[dev]"
The main client class for interacting with Heroku's Managed Inference API.
invoke(input)
- Send a message and get responsestream(input)
- Stream response chunksbind_tools(tools)
- Bind tools for function callingwith_config(config)
- Configure client settingsmodel_id
(str): Model identifierapi_key
(str): Heroku API keybase_url
(str): API base URLtemperature
(float): Response randomness (0.0-1.0)max_tokens
(int): Maximum response tokensMIT License - see LICENSE file for details.
FAQs
A Python SDK for Heroku's Managed Inference API (MIA), providing easy access to AI models through a LangChain-compatible interface.
We found that heroku-langchain-aisdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.