Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: langchain-ai/langchainjs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.1.17
Choose a base ref
...
head repository: langchain-ai/langchainjs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.1.18
Choose a head ref

Commits on Feb 8, 2024

  1. Release 0.1.17 (#4347)

    bracesproul authored Feb 8, 2024
    Copy the full SHA
    c0998cf View commit details

Commits on Feb 9, 2024

  1. langchain[patch],docs[patch]: Fix double redirect (#4348)

    * docs[patch]: Fix double redirect
    
    * cr
    
    * chore: lint files
    
    * chore: lint files
    bracesproul authored Feb 9, 2024
    Copy the full SHA
    9a47e4e View commit details
  2. core[patch]: Fix remote runnable streamLog type, update docs (#4353)

    * Fix remote runnable streamLog type, update docs
    
    * Fix lint
    
    * Remove bad test
    jacoblee93 authored Feb 9, 2024
    Copy the full SHA
    1b1ea2f View commit details
  3. Release 0.1.26

    jacoblee93 committed Feb 9, 2024
    Copy the full SHA
    ef8089e View commit details
  4. Merge pull request #4354 from langchain-ai/release

    core[patch]: Release 0.1.26
    jacoblee93 authored Feb 9, 2024
    Copy the full SHA
    44c8d54 View commit details
  5. Copy the full SHA
    5b713c2 View commit details
  6. community[patch]: Support OpenSearch Serverless (#4229)

    * fix mapping_type and addVectors
    
    * Run lint and format
    
    * Fix lint
    
    ---------
    
    Co-authored-by: jacoblee93 <jacoblee93@gmail.com>
    huuyafwww and jacoblee93 authored Feb 9, 2024
    Copy the full SHA
    82b5315 View commit details
  7. Copy the full SHA
    b52852b View commit details
  8. community[minor]: Added SQLiteRecordManager (#4321)

    * created sqlite record manager and integration tests
    
    * Updated tests and implementation
    
    * Updated tests and implementation
    
    Updated implementation to make it cleaner
    
    * some tiny refactors
    
    * cr
    
    * update peer deps, add to config file
    
    * format
    
    ---------
    
    Co-authored-by: bracesproul <braceasproul@gmail.com>
    jasonnathan and bracesproul authored Feb 9, 2024
    Copy the full SHA
    3429110 View commit details

Commits on Feb 10, 2024

  1. community[minor]: Add Dria retriever (#4302)

    * initial builds and setups
    
    * examples, integration & docs
    
    * small doc fix
    erhant authored Feb 10, 2024
    Copy the full SHA
    dcb8a18 View commit details
  2. community[minor],docs[minor]: Add UpstashVector (#4288)

    * add upstash vector integration
    
    * bump @upstash/vector
    
    * add docs
    
    * add chunk support, improve docs
    
    * address review
    
    * update vector sdk version
    
    * Apply suggestions from code review
    
    * update example
    
    * format
    
    * fix examples build
    
    * langchain[patch]: Make sitemap test integration (#4358)
    
    * rm from langchain proper
    
    ---------
    
    Co-authored-by: Brace Sproul <braceasproul@gmail.com>
    fahreddinozcan and bracesproul authored Feb 10, 2024
    Copy the full SHA
    1f1bd36 View commit details
  3. Release 0.0.27

    jacoblee93 committed Feb 10, 2024
    Copy the full SHA
    05fbaad View commit details
  4. Merge pull request #4359 from langchain-ai/release

    community[patch]: Release 0.0.27
    jacoblee93 authored Feb 10, 2024
    Copy the full SHA
    2ccff2b View commit details

Commits on Feb 11, 2024

  1. core[minor]: Adds streamEvents method to runnables (#4349)

    * Adds streamEvents method to runnables
    
    * Fix build
    
    * Cleanup
    
    * Automatically cast chat model inputs if emitted chunk is unavailable
    
    * Fix build
    
    * Start streamEvents docs
    
    * Fix streaming aggregation bug
    jacoblee93 authored Feb 11, 2024
    Copy the full SHA
    20a433a View commit details
  2. docs[minor]: Add streamEvents docs (#4365)

    * Update streamEvents docs
    
    * Update title
    jacoblee93 authored Feb 11, 2024
    Copy the full SHA
    b65210d View commit details

Commits on Feb 12, 2024

  1. Copy the full SHA
    397364e View commit details
  2. core[minor]: Adds addMessages method for chat history (#4381)

    * Adds addMessages method for chat history
    
    * Update chat_history.ts
    jacoblee93 authored Feb 12, 2024
    Copy the full SHA
    d26233d View commit details
  3. Copy the full SHA
    8d193ed View commit details
  4. Copy the full SHA
    f78f4f4 View commit details
  5. Update firebase-admin dependency (#4377)

    * bump firebase-admin dependency
    
    * update deps
    
    * fix deps
    JakubKontra authored Feb 12, 2024
    Copy the full SHA
    81560a4 View commit details

Commits on Feb 13, 2024

  1. Copy the full SHA
    02e5009 View commit details
  2. langchain[patch]: Bump langchainhub dep to latest (#4382)

    * langchain[patch]: Bump langchainhub dep to latest
    
    * cr
    
    * tilde
    bracesproul authored Feb 13, 2024
    Copy the full SHA
    e051d96 View commit details
  3. Copy the full SHA
    ae11d0a View commit details
  4. cohere[minor]: Add cohere rerank (#4380)

    * cohere[minor]: Add cohere rerank
    
    * cr
    
    * docs
    
    * chore: lint files
    
    * cr
    
    * Add sidebar
    
    * add rerank method
    
    * cr
    
    * chore: lint files
    bracesproul authored Feb 13, 2024
    Copy the full SHA
    4a8fe37 View commit details
  5. Release 0.0.5 (#4389)

    bracesproul authored Feb 13, 2024
    Copy the full SHA
    07f1616 View commit details
  6. docs[minor], core[patch]: Adds docs for creating custom modules and e…

    …xtending LangChain (#4397)
    
    * Adds docs for creating custom modules and extending LangChain
    
    * Lint
    
    * Address feedback
    jacoblee93 authored Feb 13, 2024
    Copy the full SHA
    448d98b View commit details
  7. Release 0.1.28

    jacoblee93 committed Feb 13, 2024
    Copy the full SHA
    8e3ce06 View commit details
  8. Merge pull request #4399 from langchain-ai/release

    core[patch]: Release 0.1.28
    jacoblee93 authored Feb 13, 2024
    Copy the full SHA
    b991c35 View commit details
  9. Copy the full SHA
    024dd22 View commit details
  10. cloudflare[patch]: Add metadata filtering support to Cloudflare Vecto…

    …rize (#4387)
    
    * Add metadata filtering support to Cloudflare Vectorize
    
    * Add docs for metadata filtering support to Cloudflare Vectorize
    
    * Use declared filter type
    
    ---------
    
    Co-authored-by: Jacob Lee <jacoblee93@gmail.com>
    davkorss and jacoblee93 authored Feb 13, 2024
    Copy the full SHA
    ad2a078 View commit details
  11. Copy the full SHA
    87cd549 View commit details
  12. Bump versions (#4400)

    jacoblee93 authored Feb 13, 2024
    Copy the full SHA
    5198ace View commit details
  13. Release 0.0.28

    jacoblee93 committed Feb 13, 2024
    Copy the full SHA
    ff2a5e9 View commit details
  14. Merge pull request #4401 from langchain-ai/release

    community[patch]: Release 0.0.28
    jacoblee93 authored Feb 13, 2024
    Copy the full SHA
    2afc8d6 View commit details
  15. Bump deps (#4402)

    jacoblee93 authored Feb 13, 2024
    Copy the full SHA
    db632eb View commit details
  16. langchain[patch]: Fix: Prevent text-splitter createDocments metadat…

    …a being overwritten. (#4350)
    
    * create new object fro every element
    
    * Format
    
    * Fix lint
    
    * fill array with null
    
    Array constructor simpy creates and array with empty slots, which are not the same as slots filled with the value undefined. To populate the array with placeholder values, we fill with `null`, which will get overwritten  in subsequent `map` with  new objects
    
    * make prettier happy
    
    * Fix linter warning
    
    ---------
    
    Co-authored-by: jacoblee93 <jacoblee93@gmail.com>
    iperzic and jacoblee93 authored Feb 13, 2024
    Copy the full SHA
    6541571 View commit details
Showing with 7,376 additions and 535 deletions.
  1. +5 βˆ’1 CONTRIBUTING.md
  2. +3 βˆ’1 deno.json
  3. +4 βˆ’6 docs/core_docs/docs/ecosystem/langserve.mdx
  4. +1 βˆ’1 docs/core_docs/docs/expression_language/cookbook/_category_.yml
  5. +1 βˆ’1 docs/core_docs/docs/expression_language/how_to/_category_.yml
  6. +137 βˆ’1 docs/core_docs/docs/expression_language/interface.mdx
  7. +1,846 βˆ’0 docs/core_docs/docs/expression_language/streaming.ipynb
  8. +1 βˆ’1 docs/core_docs/docs/expression_language/why.mdx
  9. +17 βˆ’0 docs/core_docs/docs/guides/extending_langchain.mdx
  10. +35 βˆ’0 docs/core_docs/docs/integrations/document_compressors/cohere_rerank.mdx
  11. +1 βˆ’1 docs/core_docs/docs/integrations/document_loaders/web_loaders/searchapi.mdx
  12. +1 βˆ’1 docs/core_docs/docs/integrations/document_loaders/web_loaders/serpapi.mdx
  13. +1 βˆ’1 docs/core_docs/docs/integrations/retrievers/chaindesk-retriever.mdx
  14. +39 βˆ’0 docs/core_docs/docs/integrations/retrievers/dria.mdx
  15. +1 βˆ’1 docs/core_docs/docs/integrations/retrievers/metal-retriever.mdx
  16. +0 βˆ’22 docs/core_docs/docs/integrations/retrievers/remote-retriever.mdx
  17. +1 βˆ’1 docs/core_docs/docs/integrations/retrievers/zep-retriever.mdx
  18. +4 βˆ’0 docs/core_docs/docs/integrations/vectorstores/cloudflare_vectorize.mdx
  19. +48 βˆ’0 docs/core_docs/docs/integrations/vectorstores/upstash.mdx
  20. +118 βˆ’1 docs/core_docs/docs/modules/agents/how_to/streaming.mdx
  21. +72 βˆ’0 docs/core_docs/docs/modules/data_connection/retrievers/custom.mdx
  22. +3 βˆ’44 docs/core_docs/docs/modules/data_connection/retrievers/index.mdx
  23. +1 βˆ’2 docs/core_docs/docs/modules/data_connection/retrievers/vectorstore.mdx
  24. +264 βˆ’0 docs/core_docs/docs/modules/data_connection/vectorstores/custom.ipynb
  25. +163 βˆ’0 docs/core_docs/docs/modules/memory/chat_messages/custom.ipynb
  26. +6 βˆ’2 docs/core_docs/docs/modules/memory/{chat_messages.mdx β†’ chat_messages/index.mdx}
  27. +125 βˆ’7 docs/core_docs/docs/modules/model_io/chat/custom_chat.mdx
  28. +113 βˆ’4 docs/core_docs/docs/modules/model_io/llms/custom_llm.mdx
  29. +437 βˆ’0 docs/core_docs/docs/modules/model_io/output_parsers/custom.ipynb
  30. +1 βˆ’1 docs/core_docs/docs/modules/model_io/output_parsers/index.mdx
  31. +1 βˆ’1 docs/core_docs/docs/modules/model_io/prompts/quick_start.mdx
  32. +15 βˆ’0 docs/core_docs/sidebars.js
  33. +0 βˆ’4 docs/core_docs/vercel.json
  34. +1 βˆ’0 examples/.eslintrc.cjs
  35. +2 βˆ’1 examples/package.json
  36. +81 βˆ’0 examples/src/agents/stream_events.ts
  37. +9 βˆ’0 examples/src/agents/stream_log.ts
  38. +0 βˆ’37 examples/src/chains/chat_vector_db_chroma.ts
  39. +0 βˆ’33 examples/src/chains/retrieval_qa_with_remote.ts
  40. +46 βˆ’0 examples/src/document_compressors/cohere_rerank.ts
  41. +52 βˆ’0 examples/src/document_compressors/cohere_rerank_compressor.ts
  42. +25 βˆ’8 examples/src/document_loaders/apify_dataset_existing.ts
  43. +25 βˆ’8 examples/src/document_loaders/apify_dataset_new.ts
  44. +31 βˆ’9 examples/src/document_loaders/searchapi.ts
  45. +27 βˆ’7 examples/src/document_loaders/serpapi.ts
  46. +1 βˆ’1 examples/src/ecosystem/langsmith.ts
  47. +103 βˆ’16 examples/src/ecosystem/langsmith_stream_log.ts
  48. +12 βˆ’10 examples/src/guides/expression_language/interface_stream_log.ts
  49. +33 βˆ’13 examples/src/indexes/text_splitter_with_chunk_header.ts
  50. +24 βˆ’5 examples/src/indexes/vector_stores/azure_aisearch/azure_aisearch.ts
  51. +25 βˆ’6 examples/src/indexes/vector_stores/azure_cosmosdb/azure_cosmosdb.ts
  52. +43 βˆ’15 examples/src/indexes/vector_stores/redis/redis_query.ts
  53. +37 βˆ’22 examples/src/indexes/vector_stores/rockset.ts
  54. +22 βˆ’0 examples/src/indexes/vector_stores/upstash/create_client.ts
  55. +28 βˆ’0 examples/src/indexes/vector_stores/upstash/delete_docs.ts
  56. +66 βˆ’0 examples/src/indexes/vector_stores/upstash/index_and_query_docs.ts
  57. +0 βˆ’4 examples/src/models/chat/custom.ts
  58. +66 βˆ’0 examples/src/models/chat/custom_advanced.ts
  59. +62 βˆ’0 examples/src/models/llm/custom_advanced.ts
  60. +48 βˆ’0 examples/src/retrievers/custom.ts
  61. +14 βˆ’0 examples/src/retrievers/dria.ts
  62. +28 βˆ’12 examples/src/use_cases/youtube/chat_with_podcast.ts
  63. +2 βˆ’1 langchain-core/package.json
  64. +40 βˆ’1 langchain-core/src/chat_history.ts
  65. +1 βˆ’1 langchain-core/src/language_models/chat_models.ts
  66. +14 βˆ’22 langchain-core/src/load/index.ts
  67. +226 βˆ’7 langchain-core/src/runnables/base.ts
  68. +3 βˆ’2 langchain-core/src/runnables/remote.ts
  69. +30 βˆ’0 langchain-core/src/runnables/tests/runnable.test.ts
  70. +25 βˆ’1 langchain-core/src/runnables/tests/runnable_remote.int.test.ts
  71. +0 βˆ’14 langchain-core/src/runnables/tests/runnable_remote.test.ts
  72. +709 βˆ’0 langchain-core/src/runnables/tests/runnable_stream_events.test.ts
  73. +70 βˆ’0 langchain-core/src/runnables/utils.ts
  74. +7 βˆ’2 langchain-core/src/tracers/base.ts
  75. +229 βˆ’13 langchain-core/src/tracers/log_stream.ts
  76. +1 βˆ’1 langchain-core/src/utils/stream.ts
  77. +4 βˆ’2 langchain-core/src/utils/testing/index.ts
  78. +1 βˆ’2 langchain/langchain.config.js
  79. +5 βˆ’5 langchain/package.json
  80. +7 βˆ’0 langchain/src/chains/graph_qa/prompts.ts
  81. +2 βˆ’2 langchain/src/chains/retrieval.ts
  82. +7 βˆ’1 langchain/src/document_loaders/tests/{sitemap.test.ts β†’ sitemap.int.test.ts}
  83. +7 βˆ’7 langchain/src/document_loaders/web/sitemap.ts
  84. +2 βˆ’0 langchain/src/experimental/openai_assistant/index.ts
  85. +0 βˆ’14 langchain/src/runnables/tests/runnable_remote.test.ts
  86. +5 βˆ’2 langchain/src/text_splitter.ts
  87. +6 βˆ’1 libs/langchain-cloudflare/src/vectorstores.ts
  88. +1 βˆ’1 libs/langchain-cohere/package.json
  89. +1 βˆ’0 libs/langchain-cohere/src/index.ts
  90. +127 βˆ’0 libs/langchain-cohere/src/rerank.ts
  91. +44 βˆ’0 libs/langchain-cohere/src/tests/rerank.int.test.ts
  92. +12 βˆ’0 libs/langchain-community/.gitignore
  93. +8 βˆ’3 libs/langchain-community/langchain.config.js
  94. +60 βˆ’5 libs/langchain-community/package.json
  95. +234 βˆ’0 libs/langchain-community/src/indexes/sqlite.ts
  96. +177 βˆ’0 libs/langchain-community/src/indexes/tests/sqlite.int.test.ts
  97. +122 βˆ’0 libs/langchain-community/src/retrievers/dria.ts
  98. +16 βˆ’0 libs/langchain-community/src/retrievers/tests/dria.int.test.ts
  99. +1 βˆ’2 libs/langchain-community/src/vectorstores/neo4j_vector.ts
  100. +53 βˆ’16 libs/langchain-community/src/vectorstores/opensearch.ts
  101. +80 βˆ’0 libs/langchain-community/src/vectorstores/tests/neo4j_vector.int.test.ts
  102. +86 βˆ’0 libs/langchain-community/src/vectorstores/tests/upstash.int.test.ts
  103. +244 βˆ’0 libs/langchain-community/src/vectorstores/upstash.ts
  104. +331 βˆ’95 yarn.lock
6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -25,7 +25,11 @@ LangChain supports several different types of integrations with third-party prov

We welcome such contributions, but ask that you read our dedicated [integration contribution guide](https://github.com/langchain-ai/langchainjs/blob/main/.github/contributing/INTEGRATIONS.md) for specific details and patterns to consider before opening a pull request.

These should generally reside in the `libs/langchain-community` workspace and be imported as `@langchain/community/module/name`, but more in-depth integrations or suites of integrations may also reside in separate packages that depend on and extend `@langchain/core`. See [`@langchain/google-genai`](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-google-genai) for an example.
You can also check out the [guide on extending LangChain.js](https://js.langchain.com/docs/guides/extending_langchain/) in our docs.

#### Integration packages

Integrations should generally reside in the `libs/langchain-community` workspace and be imported as `@langchain/community/module/name`. More in-depth integrations or suites of integrations may also reside in separate packages that depend on and extend `@langchain/core`. See [`@langchain/google-genai`](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-google-genai) for an example.

To make creating packages like this easier, we offer the [`create-langchain-integration`](https://github.com/langchain-ai/langchainjs/blob/main/libs/create-langchain-integration/) utility that will automatically scaffold a repo with support for both ESM + CJS entrypoints. You can run it like this:

4 changes: 3 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -4,13 +4,15 @@
"@langchain/community/": "npm:/@langchain/community/",
"@langchain/openai": "npm:@langchain/openai",
"@langchain/core/": "npm:/@langchain/core/",
"dotenv/": "npm:/dotenv/",
"cheerio": "npm:/cheerio",
"@langchain/pinecone": "npm:@langchain/pinecone",
"@pinecone-database/pinecone": "npm:@pinecone-database/pinecone",
"zod": "npm:/zod",
"zod-to-json-schema": "npm:/zod-to-json-schema",
"@langchain/anthropic": "npm:@langchain/anthropic",
"node-llama-cpp": "npm:/node-llama-cpp",
"readline": "https://deno.land/x/readline@v1.1.0/mod.ts"
"readline": "https://deno.land/x/readline@v1.1.0/mod.ts",
"ml-distance": "npm:/ml-distance"
}
}
10 changes: 4 additions & 6 deletions docs/core_docs/docs/ecosystem/langserve.mdx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# LangServe
# Integrating with LangServe

[LangServe](https://python.langchain.com/docs/langserve) is a Python framework that helps developers deploy LangChain [runnables and chains](/docs/expression_language/)
as REST APIs.

If you have a deployed LangServe route, you can use the [RemoteRunnable](https://api.js.langchain.com/classes/langchain_runnables_remote.RemoteRunnable.html) class to interact
with it as if it were a local chain. This allows you to more easily call hosted LangServe instances from JavaScript environments (like in the browser on the frontend).

You'll need to install or package LangChain into your frontend:
You'll need to install or package LangChain core into your frontend:

```bash npm2yarn
npm install langchain
npm install @langchain/core
```

## Usage
@@ -23,9 +23,7 @@ import Example from "@examples/ecosystem/langsmith.ts";
<CodeBlock language="typescript">{Example}</CodeBlock>

[`streamLog`](/docs/expression_language/interface) is a lower level method for streaming chain intermediate steps as partial JSONPatch chunks.
This method allows for a few extra options as well to only include or exclude certain named steps.

`@langchain/core` also provides an `applyPatch` utility for aggregating these chunks into a full output:
This method allows for a few extra options as well to only include or exclude certain named steps:

import StreamLogExample from "@examples/ecosystem/langsmith_stream_log.ts";

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
label: "Cookbook"
position: 2
position: 5
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
label: "How to"
position: 1
position: 4
138 changes: 137 additions & 1 deletion docs/core_docs/docs/expression_language/interface.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 0
sidebar_position: 2
---

import CodeBlock from "@theme/CodeBlock";
@@ -13,6 +13,7 @@ This is a standard interface with a few different methods, which make it easy to
- [`invoke`](/docs/expression_language/interface#invoke): call the chain on an input
- [`batch`](/docs/expression_language/interface#batch): call the chain on a list of inputs
- [`streamLog`](/docs/expression_language/interface#stream-log): stream back intermediate steps as they happen, in addition to the final response
- [`streamEvents`](/docs/expression_language/interface#stream-events): **beta** stream events as they happen in the chain (introduced in `@langchain/core` 0.1.27)

The **input type** varies by component :

@@ -96,3 +97,138 @@ npm install @langchain/community @langchain/openai
```

<CodeBlock language="typescript">{StreamLogExample}</CodeBlock>

## Stream events

Event Streaming is a **beta** API, and may change a bit based on feedback. It provides a way to stream both intermediate steps and final output from the chain.

Note: Introduced in `@langchain/core` 0.1.27

For now, when using the `streamEvents` API, for everything to work properly please:

- Any custom functions / runnables must propragate callbacks
- Set proper parameters on models to force the LLM to stream tokens.

### Event Reference

Here is a reference table that shows some events that might be emitted by the various Runnable objects.
Definitions for some of the Runnable are included after the table.

⚠️ When streaming the inputs for the runnable will not be available until the input stream has been entirely consumed This means that the inputs will be available at for the corresponding `end` hook rather than `start` event.

| event | name | chunk | input | output |
| -------------------- | ---------------- | ------------------------------- | --------------------------------------------- | ----------------------------------------------- |
| on_chat_model_start | [model name] | | {"messages": [[SystemMessage, HumanMessage]]} | |
| on_chat_model_stream | [model name] | AIMessageChunk(content="hello") | | |
| on_chat_model_end | [model name] | | {"messages": [[SystemMessage, HumanMessage]]} | {"generations": [...], "llm_output": None, ...} |
| on_llm_start | [model name] | | {'input': 'hello'} | |
| on_llm_stream | [model name] | 'Hello' | | |
| on_llm_end | [model name] | | 'Hello human!' |
| on_chain_start | format_docs | | | |
| on_chain_stream | format_docs | "hello world!, goodbye world!" | | |
| on_chain_end | format_docs | | [Document(...)] | "hello world!, goodbye world!" |
| on_tool_start | some_tool | | {"x": 1, "y": "2"} | |
| on_tool_stream | some_tool | {"x": 1, "y": "2"} | | |
| on_tool_end | some_tool | | | {"x": 1, "y": "2"} |
| on_retriever_start | [retriever name] | | {"query": "hello"} | |
| on_retriever_chunk | [retriever name] | {documents: [...]} | | |
| on_retriever_end | [retriever name] | | {"query": "hello"} | {documents: [...]} |
| on_prompt_start | [template_name] | | {"question": "hello"} | |
| on_prompt_end | [template_name] | | {"question": "hello"} | ChatPromptValue(messages: [SystemMessage, ...]) |

import StreamEventsExample from "@examples/agents/stream_events.ts";

<CodeBlock language="typescript">{StreamEventsExample}</CodeBlock>

```
-----
Starting agent: Agent with input: {"input":"what is the weather in SF"}
-----
Starting tool: TavilySearchResults with inputs: weather in San Francisco
-----
Finished tool: TavilySearchResults
Tool output was: [{"title":"Weather in San Francisco","url":"https://www.weatherapi.com/","content":"Weather in San Francisco is {'location': {'name': 'San Francisco', 'region': 'California', 'country': 'United States of America', 'lat': 37.78, 'lon': -122.42, 'tz_id': 'America/Los_Angeles', 'localtime_epoch': 1707638479, 'localtime': '2024-02-11 0:01'}, 'current': {'last_updated_epoch': 1707638400, 'last_updated': '2024-02-11 00:00', 'temp_c': 11.1, 'temp_f': 52.0, 'is_day': 0, 'condition': {'text': 'Partly cloudy', 'icon': '//cdn.weatherapi.com/weather/64x64/night/116.png', 'code': 1003}, 'wind_mph': 9.4, 'wind_kph': 15.1, 'wind_degree': 270, 'wind_dir': 'W', 'pressure_mb': 1022.0, 'pressure_in': 30.18, 'precip_mm': 0.0, 'precip_in': 0.0, 'humidity': 83, 'cloud': 25, 'feelslike_c': 11.5, 'feelslike_f': 52.6, 'vis_km': 16.0, 'vis_miles': 9.0, 'uv': 1.0, 'gust_mph': 13.9, 'gust_kph': 22.3}}","score":0.98371,"raw_content":null},{"title":"San Francisco, California November 2024 Weather Forecast","url":"https://www.weathertab.com/en/c/e/11/united-states/california/san-francisco/","content":"Temperature Forecast Temperature Forecast Normal Avg High Temps 60 to 70 Β°F Avg Low Temps 45 to 55 Β°F Weather Forecast Legend WeatherTAB helps you plan activities on days with the least risk of rain. Our forecasts are not direct predictions of rain/snow. Not all risky days will have rain/snow.","score":0.9517,"raw_content":null},{"title":"Past Weather in San Francisco, California, USA β€” Yesterday or Further Back","url":"https://www.timeanddate.com/weather/usa/san-francisco/historic","content":"Past Weather in San Francisco, California, USA β€” Yesterday and Last 2 Weeks. Weather. Time Zone. DST Changes. Sun & Moon. Weather Today Weather Hourly 14 Day Forecast Yesterday/Past Weather Climate (Averages) Currently: 52 Β°F. Light rain. Overcast.","score":0.945,"raw_content":null},{"title":"San Francisco, California February 2024 Weather Forecast - detailed","url":"https://www.weathertab.com/en/g/e/02/united-states/california/san-francisco/","content":"Free Long Range Weather Forecast for San Francisco, California February 2024. Detailed graphs of monthly weather forecast, temperatures, and degree days.","score":0.92177,"raw_content":null},{"title":"San Francisco Weather in 2024 - extremeweatherwatch.com","url":"https://www.extremeweatherwatch.com/cities/san-francisco/year-2024","content":"Year: What's the hottest temperature in San Francisco so far this year? As of February 2, the highest temperature recorded in San Francisco, California in 2024 is 73 Β°F which happened on January 29. Highest Temperatures: All-Time By Year Highest Temperatures in San Francisco in 2024 What's the coldest temperature in San Francisco so far this year?","score":0.91598,"raw_content":null}]
-----
| The
| current
| weather
| in
| San
| Francisco
| is
| partly
| cloudy
| with
| a
| temperature
| of
|
| 52
| .
| 0
| Β°F
| (
| 11
| .
| 1
| Β°C
| ).
| The
| wind
| speed
| is
|
| 15
| .
| 1
| k
| ph
| coming
| from
| the
| west
| ,
| and
| the
| humidity
| is
| at
|
| 83
| %.
| If
| you
| need
| more
| detailed
| information
| ,
| you
| can
| visit
| [
| Weather
| in
| San
| Francisco
| ](
| https
| ://
| www
| .weather
| api
| .com
| /
| ).
-----
Finished agent: Agent
Agent output was: The current weather in San Francisco is partly cloudy with a temperature of 52.0Β°F (11.1Β°C). The wind speed is 15.1 kph coming from the west, and the humidity is at 83%. If you need more detailed information, you can visit [Weather in San Francisco](https://www.weatherapi.com/).
-----
```
Loading