mirror of
https://github.com/Mintplex-Labs/langchain-python.git
synced 2026-07-19 21:33:31 -04:00
d3bdb8ea6d
# like [StdoutCallbackHandler](https://github.com/hwchase17/langchain/blob/master/langchain/callbacks/stdout.py), but writes to a file When running experiments I have found myself wanting to log the outputs of my chains in a more lightweight way than using WandB tracing. This PR contributes a callback handler that writes to file what `StdoutCallbackHandler` would print. <!-- Thank you for contributing to LangChain! Your PR will appear in our release under the title you set. Please make sure it highlights your valuable contribution. Replace this with a description of the change, the issue it fixes (if applicable), and relevant context. List any dependencies required for this change. After you're done, someone will review your PR. They may suggest improvements. If no one reviews your PR within a few days, feel free to @-mention the same people again, as notifications can get lost. Finally, we'd love to show appreciation for your contribution - if you'd like us to shout you out on Twitter, please also include your handle! --> ## Example Notebook <!-- If you're adding a new integration, please include: 1. a test for the integration - favor unit tests that does not rely on network access. 2. an example notebook showing its use See contribution guidelines for more information on how to write tests, lint etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md --> See the included `filecallbackhandler.ipynb` notebook for usage. Would it be better to include this notebook under `modules/callbacks` or under `integrations/`?  ## Who can review? Community members can review the PR once tests pass. Tag maintainers/contributors who might be interested: @agola11 <!-- For a quicker response, figure out the right person to tag with @ @hwchase17 - project lead Tracing / Callbacks - @agola11 Async - @agola11 DataLoaders - @eyurtsev Models - @hwchase17 - @agola11 Agents / Tools / Toolkits - @vowelparrot VectorStores / Retrievers / Memory - @dev2049 -->
38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
"""Callback handlers that allow listening to events in LangChain."""
|
|
|
|
from langchain.callbacks.aim_callback import AimCallbackHandler
|
|
from langchain.callbacks.argilla_callback import ArgillaCallbackHandler
|
|
from langchain.callbacks.clearml_callback import ClearMLCallbackHandler
|
|
from langchain.callbacks.comet_ml_callback import CometCallbackHandler
|
|
from langchain.callbacks.file import FileCallbackHandler
|
|
from langchain.callbacks.human import HumanApprovalCallbackHandler
|
|
from langchain.callbacks.manager import (
|
|
get_openai_callback,
|
|
tracing_enabled,
|
|
wandb_tracing_enabled,
|
|
)
|
|
from langchain.callbacks.mlflow_callback import MlflowCallbackHandler
|
|
from langchain.callbacks.openai_info import OpenAICallbackHandler
|
|
from langchain.callbacks.stdout import StdOutCallbackHandler
|
|
from langchain.callbacks.streaming_aiter import AsyncIteratorCallbackHandler
|
|
from langchain.callbacks.wandb_callback import WandbCallbackHandler
|
|
from langchain.callbacks.whylabs_callback import WhyLabsCallbackHandler
|
|
|
|
__all__ = [
|
|
"ArgillaCallbackHandler",
|
|
"OpenAICallbackHandler",
|
|
"StdOutCallbackHandler",
|
|
"FileCallbackHandler",
|
|
"AimCallbackHandler",
|
|
"WandbCallbackHandler",
|
|
"MlflowCallbackHandler",
|
|
"ClearMLCallbackHandler",
|
|
"CometCallbackHandler",
|
|
"WhyLabsCallbackHandler",
|
|
"AsyncIteratorCallbackHandler",
|
|
"get_openai_callback",
|
|
"tracing_enabled",
|
|
"wandb_tracing_enabled",
|
|
"HumanApprovalCallbackHandler",
|
|
]
|