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/modules
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
..
agents Harrison/pubmed integration (#5664) 1 year ago
callbacks FileCallbackHandler (#5589) 1 year ago
chains Fixed multi input prompt for MapReduceChain (#4979) 1 year ago
indexes Created fix for 5475 (#5659) 1 year ago
memory fix: correct momento chat history notebook typo and title (#5646) 1 year ago
models Harrison/update azure nb (#5665) 1 year ago
prompts docs: `modules` pages simplified (#5116) 1 year ago
utils/examples Pass parsed inputs through to tool _run (#4309) 1 year ago
agents.rst docs: `modules` pages simplified (#5116) 1 year ago
chains.rst docs: `modules` pages simplified (#5116) 1 year ago
indexes.rst docs: `modules` pages simplified (#5116) 1 year ago
memory.rst docs: `modules` pages simplified (#5116) 1 year ago
models.rst docs: `modules` pages simplified (#5116) 1 year ago
paul_graham_essay.txt Fix notebook example (#3142) 1 year ago
prompts.rst docs: `modules` pages simplified (#5116) 1 year ago
state_of_the_union.txt Docs refactor (#480) 2 years ago