Skip to main content

LangChain Goodfire Integration

This package contains the LangChain integration for the Goodfire API.

Installation

pip install langchain-goodfire

Usage

from langchain_goodfire import ChatGoodfire
from langchain_core.messages import SystemMessage, HumanMessage
import goodfire

chat = ChatGoodfire(
    model=goodfire.Variant("meta-llama/Llama-3.3-70B-Instruct"),
    goodfire_api_key="your-api-key"
)

messages = [
    SystemMessage(content="You are a helpful assistant."),
    HumanMessage(content="Hello!")
]

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

Async Environment Usage

When using this package in an environment with an existing event loop (e.g., Jupyter notebook):

  • Use the async versions of methods since an event loop is already running
  • Replace chat.invoke(messages) with await chat.ainvoke(messages)
  • Similarly, use await chat.abatch(...), await chat.astream(...), etc.

Technical Note: Synchronous methods won't work in environments with an existing event loop because the Goodfire client library uses asyncio internally. When an event loop is already running, you must use async methods to properly interface with the Goodfire client library.

Development

To install the package in development mode:

pip install -e .

Testing

Run tests using pytest:

# run unit tests without network access
poetry run pytest --disable-socket --allow-unix-socket --asyncio-mode=auto tests/unit_tests
# run integration tests
poetry run pytest --asyncio-mode=auto tests/integration_tests

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.

Support

For support, please open an issue on the GitHub repository.

Metadata

Release files for langchain-goodfire 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-goodfire 0.2.4
File Size Uploaded Provenance Actions
langchain_goodfire-0.2.4.tar.gz 7.2 kB Without provenance Details for langchain_goodfire-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-goodfire 0.2.4
File Interpreter ABI Platform Actions
langchain_goodfire-0.2.4-py3-none-any.whl Python 3 none any Details for langchain_goodfire-0.2.4-py3-none-any.whl

Total release size: 13.0 kB

Release files / langchain_goodfire-0.2.4.tar.gz

Download URL langchain_goodfire-0.2.4.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
af8b254f47299c781a501b572b64a184d839b8a45f8aba75e1d5490b36765ab3
BLAKE2b-256 checksum
How to use checksums
a778359da92f0721dbdf2bcd1c26a325edac28e805a77bd7b829d64071d2403e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / langchain_goodfire-0.2.4-py3-none-any.whl

Download URL langchain_goodfire-0.2.4-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69ae3fc4c041214d9d251242e378e5c026a681b75213fde8b63a5d52639e9022
BLAKE2b-256 checksum
How to use checksums
a81633ad270b54c22a5d1edd8e47e864ebfbf850c659337a83e45fa63b69e1e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for langchain-goodfire 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page