You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/docs
mbchang d3bdb8ea6d
FileCallbackHandler (#5589)
# 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/`?

![image](https://github.com/hwchase17/langchain/assets/6439365/c624de0e-343f-4eab-a55b-8808a887489f)


## 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

 -->
1 year ago
..
_static docs: Big Mendable Improvements (#4964) 1 year ago
additional_resources docs: `Deployments` page moved into `Ecosystem/` (#4949) 1 year ago
ecosystem Add Chainlit to deployment options (#5314) 1 year ago
getting_started added DeepLearing.AI course link (#5518) 1 year ago
integrations docs `ecosystem/integrations` update 4 (#5590) 1 year ago
modules FileCallbackHandler (#5589) 1 year ago
reference Documentation fixes (linting and broken links) (#5563) 1 year ago
templates docs `ecosystem/integrations` update 3 (#5470) 1 year ago
tracing py tracer fixes (#5377) 1 year ago
use_cases minor refactor GenerativeAgentMemory (#5315) 1 year ago
Makefile Feature: linkcheck-action (#534) (#542) 2 years ago
conf.py docs: Mendable Search integration (#2803) 1 year ago
dependents.md docs: added `ecosystem/dependents` page (#4941) 1 year ago
index.rst docs: `Deployments` page moved into `Ecosystem/` (#4949) 1 year ago
integrations.rst docs: `ecosystem/integrations` update 1 (#5219) 1 year ago
make.bat initial commit 2 years ago
reference.rst docs: `Deployments` page moved into `Ecosystem/` (#4949) 1 year ago
requirements.txt Harrison/docs reqs (#2199) 1 year ago