mirror of
https://github.com/langchain-ai/langgraphjs.git
synced 2026-07-21 16:45:24 -04:00
streamEvents() with v2 schema and ChatAnthropic #46
Closed
opened 2026-02-15 17:14:58 -05:00 by yindo
·
25 comments
No Branch/Tag Specified
main
fix/usestream-hydrate-null-thread-reconnect
chore/dependabot-docker-root-coverage
open-swe/accept-semver-ranges
wfh/fix_store
cb/reconnect-upstream
nh/integration-managed-runtime-tests
open-swe/usestream-status-enum
hunter/bump-checkpoint-dep
cb/bundle-uuid-cjs-66cc
cb/dedup-stream-sse-decoder-96cd
dependabot/npm_and_yarn/internal/bench/npm_and_yarn-18a2f9e291
cb/normalize-openai-function-call-tool-calls
cb/tmp
cb/remove-docs
nh/sdk-normalize-base-message-v2
nh/sdk-reencode-tool-call-chunks
nh/sdk-normalize-base-message
nh/stream-v2-final-split
open-swe/c802e0ea-c9e5-c8c6-824a-c065dd2bfd6f
hunter/memory-investigation-2
ramonn/checkpoint-durable-objects
open-swe/776ee51f-5e2f-752b-acb1-4584467156d4
hunter/issue-2303-regression-test
cb/api-stream-reducer
open-swe/77892c09-3e94-9f8a-5f5b-3d2787c5f6b9
cb/in-process-streaming
cb/langgraph-streaming-protocol-683b
cb/protocol-v2-tests-6203
cb/fix-custom-submit-options-ad3e
cb/protocol-thread-binding-clean-6303
hunter/keep-important-ids
cb/fix-protocol-thread-binding-6303
cb/react-protocol-runtime-8ca7
cb/pregel-eli5-doc-1103
cb/-bc-5a4705b9-850e-4f7d-95ea-67c0741e9977-92c3
cb/pr-branch-rebase-4816
cb/-bc-2d03efa3-5ef0-4b68-bf53-63005b8e748f-8924-angular-svelte
cb/-bc-2d03efa3-5ef0-4b68-bf53-63005b8e748f-8924
cb/langchain-react-ssr-proposal-972b
cb/agent-streaming-protocol-design-25d1
cb/custom-transport-queue-parity-2bb9
cb/frontend-integration-strategy-64ce
brydar/fix/parallel-interrupt-accumulation
cb/agent-multi-app-support-d2d0
cb/svelte-5-idiomatic-patterns-16ed
cb/frontend-sdks-developer-experience-8030
cb/ui-packages-idiomatic-review-35a4
hunter/fix-vercel-ci
fix/test-exports-vercel-next16-lint
dependabot/npm_and_yarn/internal/environment_tests/test-exports-vercel/npm_and_yarn-229c191f58
cb/stream-protocol-improvements
jdr/fix-sdk-errors
cb/async_hooks-fix
cwlbraa/fix-getmessages-null-state
chore/fix-dependabot-config
hunter/fix-symbol-types
hunter/symbol-fix
hunter/symbol-annotations
test-ci-trigger
hunter/lg-resolve-symbols
colifran/tool-stream-types
colifran/tool-stream-types-temp
dqbd/sdk-ui-other-fw
colifran/tool-streaming-example
colifran/tool-stream-example
fix/security-alerts-2026-02-19
cb/perf-improvements
jk/fix-rolldown-panic
cb/better-node-version-definition
cb/tsdown-setup
cb/create-changesets
cb/pnpm-fix4
cb/pnpm-fix2
wfh/fix_release
demo
cb/browser-tools
v0.3
pr/christymanthara/1787
cb/type-safe-streaming
mdrxy/delete-docs
changeset-release/v1
v1
v0
rd3
isaac/vb
dqbd/remove-get-graph-non-async
dqbd/serde-v1
dqbd/1.0.0-alpha.1
dqbd/max-version-cache
parker/custom-studio-url-cli
dqbd/standard-schema
dqbd/create-agent-middleware
dqbd/1.0.0-alpha
parker/api-linting
dqbd/prebuilt-restart-subgraph
dqbd/api-thread-join-stream
dqbd/persist-resume-map-values
wfh/default
dqbd/node-recursion-limit
sam_support_description_for_mcp
hunter/dedupe-signal-listeners
wfh/studio_auth_access
wfh/consistent_kind
release
brace/pass-update-generic-msgs-zod
dqbd/merge-api
hunter/zod-intersection
vb/add-forward-message-tool
dqbd/zod-metadata-json-schema-extra
wfh/js_node_finished
ben/checkpoint-metadata-custom-fields
dqbd/release-0.2.56-second
ben/docs-learning-path
ben/typed-exec
vb/support-checkpointer-true
dqbd/stream-mode-messages-input-no-emit
dqbd/tsc-module-es2020
jacob/nits
cc/docs_layout
dqbd/tasks-results
brace/update-how-to-hitl-index
jacob/sendv2
dqbd/command-goto
jacob/stream_messages
jacob/supabase
brace/updated-mem-conceptual
471
allan/first-agent-tutorial
brace/req-config
nc/23sep/stream-output
allan/subgraphs
brace/stores
brace/memory
jacob/rc
isaac/contextchannel
brace/subgraphs
wfh/typedocs
0.1
isaac/doclink
jacob/mongo
testing
nc/11aug/archs
jacob/streaming_tool_call
jacob/messagesstate
wfh/pae
wfh/moore_tutorials_tsc
wfh/drd
wfh/edgy
brace/langgraph-self-rag-oss
brace/prebuilt
brace/state-graph
brace/bump-lc-core
brace/typing
brace/examples
nc/fixup
brace/package-infra
brace/allow-channel-string
@langchain/vue@1.0.28
@langchain/svelte@1.0.28
@langchain/react@1.0.28
@langchain/langgraph-sdk@1.9.27
@langchain/angular@1.0.28
@langchain/vue@1.0.27
@langchain/svelte@1.0.27
@langchain/react@1.0.27
@langchain/langgraph@1.4.8
@langchain/langgraph-ui@1.4.3
@langchain/langgraph-sdk@1.9.26
@langchain/langgraph-cli@1.4.3
@langchain/langgraph-api@1.4.3
@langchain/angular@1.0.27
@langchain/langgraph-ui@1.4.2
@langchain/langgraph-cli@1.4.2
@langchain/langgraph-api@1.4.2
@langchain/langgraph@1.4.7
@langchain/vue@1.0.26
@langchain/svelte@1.0.26
@langchain/react@1.0.26
@langchain/langgraph@1.4.6
@langchain/langgraph-ui@1.4.1
@langchain/langgraph-sdk@1.9.25
@langchain/langgraph-cli@1.4.1
@langchain/langgraph-checkpoint@1.1.3
@langchain/langgraph-checkpoint-postgres@1.0.4
@langchain/langgraph-api@1.4.1
@langchain/angular@1.0.26
@langchain/vue@1.0.25
@langchain/svelte@1.0.25
@langchain/react@1.0.25
@langchain/langgraph@1.4.5
@langchain/langgraph-ui@1.4.0
@langchain/langgraph-sdk@1.9.24
@langchain/langgraph-cli@1.4.0
@langchain/langgraph-checkpoint-mongodb@1.4.0
@langchain/langgraph-api@1.4.0
@langchain/angular@1.0.25
@langchain/vue@1.0.24
@langchain/svelte@1.0.24
@langchain/react@1.0.24
@langchain/langgraph@1.4.4
@langchain/langgraph-sdk@1.9.23
@langchain/langgraph-checkpoint@1.1.2
@langchain/langgraph-checkpoint-redis@1.0.10
@langchain/angular@1.0.24
@langchain/vue@1.0.23
@langchain/svelte@1.0.23
@langchain/react@1.0.23
@langchain/langgraph@1.4.2
@langchain/langgraph-ui@1.3.1
@langchain/langgraph-supervisor@1.1.1
@langchain/langgraph-sdk@1.9.22
@langchain/langgraph-cli@1.3.1
@langchain/langgraph-checkpoint@1.1.1
@langchain/langgraph-checkpoint-redis@1.0.9
@langchain/langgraph-api@1.3.1
@langchain/angular@1.0.23
@langchain/vue@1.0.22
@langchain/svelte@1.0.22
@langchain/react@1.0.22
@langchain/langgraph@1.4.1
@langchain/langgraph-supervisor@1.1.0
@langchain/langgraph-sdk@1.9.21
@langchain/angular@1.0.22
@langchain/vue@1.0.21
@langchain/svelte@1.0.21
@langchain/react@1.0.21
@langchain/langgraph@1.4.0
@langchain/langgraph-checkpoint@1.1.0
@langchain/langgraph-checkpoint-sqlite@1.0.3
@langchain/langgraph-checkpoint-redis@1.0.8
@langchain/langgraph-checkpoint-postgres@1.0.3
@langchain/langgraph-checkpoint-mongodb@1.3.4
@langchain/angular@1.0.21
@langchain/vue@1.0.20
@langchain/svelte@1.0.20
@langchain/react@1.0.20
@langchain/langgraph-sdk@1.9.20
@langchain/angular@1.0.20
@langchain/vue@1.0.19
@langchain/svelte@1.0.19
@langchain/react@1.0.19
@langchain/langgraph@1.3.7
@langchain/langgraph-ui@1.3.0
@langchain/langgraph-sdk@1.9.19
@langchain/langgraph-cli@1.3.0
@langchain/langgraph-checkpoint-validation@1.1.0
@langchain/langgraph-checkpoint-sqlite@1.0.2
@langchain/langgraph-api@1.3.0
@langchain/angular@1.0.19
@langchain/vue@1.0.18
@langchain/svelte@1.0.18
@langchain/react@1.0.18
@langchain/langgraph-sdk@1.9.18
@langchain/angular@1.0.18
@langchain/vue@1.0.17
@langchain/svelte@1.0.17
@langchain/react@1.0.17
@langchain/langgraph@1.3.6
@langchain/langgraph-ui@1.2.5
@langchain/langgraph-sdk@1.9.17
@langchain/langgraph-cli@1.2.5
@langchain/langgraph-api@1.2.5
@langchain/angular@1.0.17
@langchain/vue@1.0.16
@langchain/svelte@1.0.16
@langchain/react@1.0.16
@langchain/langgraph@1.3.5
@langchain/langgraph-sdk@1.9.16
@langchain/angular@1.0.16
@langchain/vue@1.0.15
@langchain/svelte@1.0.15
@langchain/react@1.0.15
@langchain/langgraph-sdk@1.9.15
@langchain/angular@1.0.15
@langchain/vue@1.0.14
@langchain/svelte@1.0.14
@langchain/react@1.0.14
@langchain/langgraph-sdk@1.9.14
@langchain/angular@1.0.14
@langchain/vue@1.0.13
@langchain/svelte@1.0.13
@langchain/react@1.0.13
@langchain/langgraph-sdk@1.9.13
@langchain/angular@1.0.13
@langchain/vue@1.0.12
@langchain/svelte@1.0.12
@langchain/react@1.0.12
@langchain/langgraph@1.3.4
@langchain/langgraph-sdk@1.9.12
@langchain/langgraph-checkpoint-mongodb@1.3.3
@langchain/angular@1.0.12
@langchain/vue@1.0.11
@langchain/svelte@1.0.11
@langchain/react@1.0.11
@langchain/langgraph@1.3.3
@langchain/langgraph-ui@1.2.4
@langchain/langgraph-supervisor@1.0.4
@langchain/langgraph-sdk@1.9.11
@langchain/langgraph-cli@1.2.4
@langchain/langgraph-checkpoint@1.0.4
@langchain/langgraph-checkpoint-redis@1.0.7
@langchain/langgraph-checkpoint-postgres@1.0.2
@langchain/langgraph-checkpoint-mongodb@1.3.2
@langchain/langgraph-api@1.2.4
@langchain/angular@1.0.11
@langchain/vue@1.0.10
@langchain/svelte@1.0.10
@langchain/react@1.0.10
@langchain/langgraph-ui@1.2.3
@langchain/langgraph-sdk@1.9.10
@langchain/langgraph-cli@1.2.3
@langchain/langgraph-checkpoint@1.0.3
@langchain/langgraph-checkpoint-redis@1.0.6
@langchain/langgraph-api@1.2.3
@langchain/angular@1.0.10
@langchain/vue@1.0.9
@langchain/svelte@1.0.9
@langchain/react@1.0.9
@langchain/langgraph-sdk@1.9.9
@langchain/angular@1.0.9
@langchain/vue@1.0.8
@langchain/svelte@1.0.8
@langchain/react@1.0.8
@langchain/langgraph-sdk@1.9.8
@langchain/angular@1.0.8
@langchain/vue@1.0.7
@langchain/svelte@1.0.7
@langchain/react@1.0.7
@langchain/langgraph-sdk@1.9.7
@langchain/angular@1.0.7
@langchain/vue@1.0.6
@langchain/svelte@1.0.6
@langchain/react@1.0.6
@langchain/langgraph-sdk@1.9.6
@langchain/angular@1.0.6
@langchain/vue@1.0.5
@langchain/svelte@1.0.5
@langchain/react@1.0.5
@langchain/langgraph-supervisor@1.0.3
@langchain/langgraph-sdk@1.9.5
@langchain/langgraph-checkpoint-redis@1.0.5
@langchain/angular@1.0.5
@langchain/vue@1.0.4
@langchain/svelte@1.0.4
@langchain/react@1.0.4
@langchain/langgraph@1.3.2
@langchain/langgraph-sdk@1.9.4
@langchain/angular@1.0.4
@langchain/vue@1.0.3
@langchain/svelte@1.0.3
@langchain/langgraph@1.3.1
@langchain/langgraph-swarm@1.0.2
@langchain/langgraph-supervisor@1.0.2
@langchain/angular@1.0.3
@langchain/vue@1.0.2
@langchain/svelte@1.0.2
@langchain/react@1.0.2
@langchain/langgraph-sdk@1.9.2
@langchain/angular@1.0.2
@langchain/vue@1.0.1
@langchain/angular@1.0.1
@langchain/vue@1.0.0
@langchain/react@1.0.0
@langchain/langgraph-cli@1.2.0
@langchain/langgraph-api@1.2.0
@langchain/angular@1.0.0
@langchain/vue@0.4.7
@langchain/svelte@0.4.7
@langchain/react@0.3.5
@langchain/angular@0.4.7
@langchain/vue@0.4.6
@langchain/svelte@0.4.6
@langchain/react@0.3.4
@langchain/langgraph-sdk@1.8.10
@langchain/angular@0.4.6
@langchain/langgraph-checkpoint-mongodb@1.3.0
@langchain/langgraph@1.2.9
@langchain/langgraph-sdk@1.8.9
@langchain/langgraph@1.2.8
@langchain/vue@0.4.5
@langchain/svelte@0.4.5
@langchain/react@0.3.3
@langchain/langgraph-sdk@1.8.8
@langchain/angular@0.4.5
@langchain/vue@0.4.4
@langchain/svelte@0.4.4
@langchain/angular@0.4.4
@langchain/vue@0.4.3
@langchain/svelte@0.4.3
@langchain/angular@0.4.3
@langchain/vue@0.4.2
@langchain/svelte@0.4.2
@langchain/react@0.3.2
@langchain/langgraph-sdk@1.8.7
@langchain/angular@0.4.2
@langchain/vue@0.4.1
@langchain/svelte@0.4.1
@langchain/react@0.3.1
@langchain/langgraph-sdk@1.8.6
@langchain/angular@0.4.1
@langchain/vue@0.4.0
@langchain/svelte@0.4.0
@langchain/react@0.3.0
@langchain/langgraph@1.2.7
@langchain/angular@0.4.0
@langchain/vue@0.3.4
@langchain/svelte@0.3.2
@langchain/react@0.2.4
@langchain/langgraph-sdk@1.8.5
@langchain/angular@0.3.3
@langchain/vue@0.3.3
@langchain/langgraph-sdk@1.8.4
@langchain/vue@0.3.2
@langchain/langgraph-sdk@1.8.3
@langchain/angular@0.3.2
@langchain/react@0.2.3
@langchain/langgraph-sdk@1.8.2
@langchain/langgraph-ui@1.1.17
@langchain/langgraph-cli@1.1.17
@langchain/langgraph-api@1.1.17
@langchain/vue@0.3.1
@langchain/svelte@0.3.1
@langchain/react@0.2.2
@langchain/langgraph@1.2.6
@langchain/langgraph-sdk@1.8.1
@langchain/angular@0.3.1
@langchain/vue@0.3.0
@langchain/svelte@0.3.0
@langchain/react@0.2.1
@langchain/langgraph@1.2.5
@langchain/langgraph-sdk@1.8.0
@langchain/angular@0.3.0
@langchain/vue@0.2.0
@langchain/svelte@0.2.0
@langchain/react@0.2.0
@langchain/langgraph@1.2.4
@langchain/langgraph-sdk@1.7.5
@langchain/angular@0.2.0
@langchain/langgraph-sdk@1.7.4
@langchain/langgraph@1.2.3
@langchain/langgraph-ui@1.1.16
@langchain/langgraph-sdk@1.7.3
@langchain/langgraph-cli@1.1.16
@langchain/langgraph-checkpoint@1.0.1
@langchain/langgraph-checkpoint-redis@1.0.4
@langchain/langgraph-api@1.1.16
@langchain/langgraph-sdk@1.7.2
@langchain/vue@0.1.3
@langchain/svelte@0.1.3
@langchain/react@0.1.3
@langchain/langgraph-sdk@1.7.1
@langchain/angular@0.1.3
@langchain/vue@0.1.2
@langchain/svelte@0.1.2
@langchain/react@0.1.2
@langchain/angular@0.1.2
@langchain/langgraph@1.2.1
@langchain/langgraph-ui@1.1.15
@langchain/langgraph-cli@1.1.15
@langchain/langgraph-checkpoint-redis@1.0.3
@langchain/langgraph-api@1.1.15
@langchain/langgraph@1.2.0
@langchain/langgraph-ui@1.1.14
@langchain/langgraph-sdk@1.6.5
@langchain/langgraph-cli@1.1.14
@langchain/langgraph-checkpoint-mongodb@1.2.0
@langchain/langgraph-api@1.1.14
@langchain/langgraph-sdk@1.6.4
@langchain/langgraph-checkpoint-postgres@1.0.1
@langchain/langgraph-sdk@1.6.3
@langchain/langgraph@1.1.5
@langchain/langgraph-ui@2.0.0
@langchain/langgraph-sdk@2.0.0
@langchain/langgraph-cli@2.0.0
@langchain/langgraph-api@2.0.0
@langchain/langgraph-ui@1.1.13
@langchain/langgraph-sdk@1.6.2
@langchain/langgraph-cli@1.1.13
@langchain/langgraph-api@1.1.13
@langchain/langgraph-sdk@1.6.1
@langchain/langgraph@1.1.4
@langchain/langgraph-sdk@1.6.0
@langchain/langgraph-ui@1.1.12
@langchain/langgraph-sdk@1.5.6
@langchain/langgraph-cli@1.1.12
@langchain/langgraph-checkpoint-redis@1.0.2
@langchain/langgraph-checkpoint-mongodb@1.1.7
@langchain/langgraph-api@1.1.12
@langchain/langgraph@1.1.3
@langchain/langgraph-checkpoint-sqlite@1.0.1
@langchain/langgraph@1.1.2
@langchain/langgraph@1.1.1
@langchain/langgraph-sdk@1.5.5
@langchain/langgraph@1.1.0
@langchain/langgraph-sdk@1.5.4
@langchain/langgraph-sdk@1.5.3
@langchain/langgraph-checkpoint-validation@1.0.9
@langchain/langgraph-sdk@1.5.2
@langchain/langgraph-sdk@1.5.1
@langchain/langgraph@1.0.15
@langchain/langgraph-ui@1.1.11
@langchain/langgraph-sdk@1.5.0
@langchain/langgraph-cli@1.1.11
@langchain/langgraph-api@1.1.11
create-langgraph@1.1.5
@langchain/langgraph@1.0.14
@langchain/langgraph-ui@1.1.10
@langchain/langgraph-sdk@1.4.6
@langchain/langgraph-cli@1.1.10
@langchain/langgraph-checkpoint-validation@1.0.8
@langchain/langgraph-checkpoint-mongodb@1.1.6
@langchain/langgraph-api@1.1.10
@langchain/langgraph-api@1.1.9
@langchain/langgraph@1.0.13
@langchain/langgraph-ui@1.1.9
@langchain/langgraph-sdk@1.4.5
@langchain/langgraph-cli@1.1.9
@langchain/langgraph-checkpoint-validation@1.0.7
@langchain/langgraph-checkpoint-mongodb@1.1.5
create-langgraph@1.1.4
@langchain/langgraph-api@1.1.8
@langchain/langgraph@1.0.12
@langchain/langgraph-ui@1.1.8
@langchain/langgraph-sdk@1.4.4
@langchain/langgraph-cli@1.1.8
@langchain/langgraph-checkpoint-validation@1.0.6
@langchain/langgraph-checkpoint-mongodb@1.1.4
create-langgraph@1.1.3
@langchain/langgraph-ui@0.0.43
@langchain/langgraph-cli@0.0.43
@langchain/langgraph-api@0.0.43
@langchain/langgraph-api@0.0.42
@langchain/langgraph-ui@0.0.42
@langchain/langgraph-cli@0.0.42
@langchain/langgraph-sdk@0.0.90
0.3.6
0.3.5
0.3.4
supervisor==0.0.14
0.3.3
@langgraph-supervisor@0.0.14
0.3.2
0.3.1
0.3.0
checkpoint==0.0.18
swarm==0.0.4
supervisor==0.0.13
cua==0.0.6
0.2.74
0.2.73
checkpoint-sqlite==0.1.5
supervisor==0.0.12
0.2.72
0.2.71
0.2.70
0.2.69
checkpoint-postgres==0.0.5
@langchain/langgraph-checkpoint-postgres==0.0.5
0.2.68
0.2.67
0.2.66
0.2.65
0.2.64
supervisor==0.0.11
supervisor==0.0.10
0.2.63
0.2.57
0.2.56
0.2.35
0.2.59
0.2.40
0.2.58
0.2.62
0.2.61
0.2.60
0.2.55
0.2.54
checkpoint==0.0.16
swarm==0.0.3
supervisor==0.0.9
swarm==0.0.2
supervisor==0.0.8
0.2.53
0.2.52
swarm==0.0.1
supervisor==0.0.7
0.2.51
supervisor==0.0.6
supervisor==0.0.5
0.2.50
0.2.49
0.2.48
0.2.47
checkpoint-mongodb==0.0.6
checkpoint-postgres==0.0.4
0.2.46
0.2.45
0.2.44
checkpoint-postgres==0.0.3
checkpoint-sqlite==0.1.4
checkpoint-mongodb=0.0.5
checkpoint==0.0.15
0.2.43
0.2.42
checkpoint==0.0.14
0.2.41
0.2.39
0.2.38
0.2.37
0.2.36
0.2.34
0.2.33
0.2.32
0.2.31
0.2.30
0.2.29
0.2.28
0.2.27
0.2.26
0.2.25
0.2.24
0.2.23
0.2.22
0.2.21
0.2.20
0.2.19
0.2.18
0.2.17
0.2.16
0.2.15
0.2.14
0.2.13
0.2.12
0.2.11
0.2.10
0.2.9
0.2.8
0.2.7
0.2.6
0.2.5
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.34
0.0.33
0.0.32
0.0.31
0.0.30
0.0.29
0.0.28
0.0.27
0.0.26
0.0.25
0.0.24
0.0.23
0.0.22
0.0.21
0.0.20
0.0.19
0.0.18
0.0.17
0.0.16
0.0.15
0.0.14
0.0.13
0.0.12
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: langchain-ai/langgraphjs#46
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lionkeng on GitHub (Jul 11, 2024).
I am trying out the streaming example provided in your documentation here with v2 schema. I got it to work based on suggestion provided by @jacoblee93 here
The code works when I use ChatOpenAI as the model. But it is not working when I swap the model with ChatAnthropic. What am I missing? Thank you.
@hwchase17 commented on GitHub (Jul 11, 2024):
when you say "not working" - what exactly is happening?
@bracesproul commented on GitHub (Jul 11, 2024):
+1 to Harrison's comment.
If you're referencing not being able to access token counts when streaming tool calls, I just pushed a fix here. I also see some other issues with your code. For extracting tool calls from messages, you should be looking inside
message.tool_callsnotmessage.additional_kwargs.tool_calls. If there's another bug, please let me know what the issue is and I can work it out. Thanks!@lionkeng commented on GitHub (Jul 11, 2024):
@bracesproul thank you! I see that too. But I seem to be running into something more fundamental.
@bracesproul commented on GitHub (Jul 11, 2024):
@lionkeng what exactly is the issue? If you could provide a stack trace and an in depth description of the issue I can help fix it.
@lionkeng commented on GitHub (Jul 11, 2024):
@bracesproul
There is no stack trace per-se as the program/script just runs but doesn't encounter any event named
on_chat_model_stream. So if I run the script as shown above, the console.log will output all of the following but missingon_chat_model_stream:@bracesproul commented on GitHub (Jul 11, 2024):
Okay just dug into this, we don't support streaming tool calls with anthropic in the way you'd think. So yes you can call model.stream and it'll work, but under the hood of the
ChatAnthropicclass we're calling the non streaming method if there are tool calls. So because of this,streamEventswon't yield that event.This is a top priority for us though, and we're aiming to get this implemented by midway through next week.
@lionkeng commented on GitHub (Jul 11, 2024):
Thanks for the response @bracesproul ! Looking forwarding to testing out the changes.
@danny-avila commented on GitHub (Jul 23, 2024):
Still having streaming issues with ChatAnthropic using
streamEventsandv2in particular.Here are my langchain-specific dependencies from my project package.json:
Code to Reproduce:
Note: this correctly streams tokens when we don't bind tools, but if we do, it fails.
Output:
Output if model is not bound
@jacoblee93 commented on GitHub (Jul 23, 2024):
CC @bracesproul can you have a look?
@wh1pp3rz commented on GitHub (Jul 24, 2024):
There's an issue when using ChatAnthropic with tools bound and trying to stream, whether regular stream or streamEvents. There seem to be some logic expecting the message content to be a string. The console warning
The "tool_calls" field on a message is only respected if content is a string.is being shown. When I dump the content, it's not a string but an object that looks like this:@jacoblee93 commented on GitHub (Jul 24, 2024):
Thanks for the heads up, will have a look!
@danny-avila commented on GitHub (Jul 24, 2024):
Same issue here thanks for sharing
@jacoblee93 commented on GitHub (Jul 24, 2024):
Really sorry about this 😕
@bracesproul commented on GitHub (Jul 24, 2024):
@danny-avila @wh1pp3rz I just released version
0.2.9with a fix. Please ping me if you experience any other issues.@wh1pp3rz commented on GitHub (Jul 24, 2024):
Thanks @bracesproul , I'm no longer getting the error, however
ChatAnthropicdoesn't seem to work as expected. Take this sample code for example:With ChatOpenAI the proper output is streamed, and looks like this:
However when I replace the model with
ChatAnthropicand without changing anything else, the output now looks like this:It seems ChatAnthropic is streaming the tool call, but not the final response.
@bracesproul commented on GitHub (Jul 24, 2024):
It looks like Anthropic is calling a tool here and OpenAI isn't because the LLM "thinks" it knows the answer? If you send me a LangSmith trace of both I could see what's going on
@wh1pp3rz commented on GitHub (Jul 24, 2024):
OpenAI is definitely calling a tool. Here's the LangSmith trace
And. here's the trace for ChatAnthropic
@lionkeng commented on GitHub (Jul 25, 2024):
@bracesproul
I have updated to 0.2.9 but it is still not working as expected.
I am looking for some guidance on whether this is a bug in my code or in the Langgraph/LangchainJS implementation.
My code example lives here, nothing fancy and actually looks a lot like the code example in the Langgraph documentation.
Here is a langsmith trace with ChatAnthropic.
Here is the langsmith tracing with the same code but I swapped out ChatAnthropic with ChatOpenAI - and it appears to work there.
If I look at the
runsview on the langsmith dashboard, the ChatAnthropic call seems to be running outside of the Langgraph/RunnableLambda nesting.With ChatOpenAI, the call is nested in the RunnableLambda.

@jacoblee93 commented on GitHub (Jul 25, 2024):
Ah @wh1pp3rz I think Anthropic is streaming back a chunk where
contentis an array instead of a string, and LangSmith is not rendering it properly. I'll flag that with the team, but this is within our spec - I can see how it is confusing but Anthropic could theoretically call another tool in a block after that call, so we can't just stream back string chunks here. See theRaw Outputof your trace below.@lionkeng can you try setting
resolutionsas described here?https://langchain-ai.github.io/langgraphjs/how-tos/manage-ecosystem-dependencies/
@wh1pp3rz commented on GitHub (Jul 25, 2024):
@jacoblee93 what would be the proper way to stream the final result of a chain when using anthropic with tools bound and streamEvents v2?
@lionkeng commented on GitHub (Jul 25, 2024):
@jacoblee93
I can try setting resolutions. But what should be the right combination of versions to use for the different packages?
Here are the relevant versions of packages from the langchain eco that I am using as shown by a
pnpm list.@danny-avila commented on GitHub (Jul 27, 2024):
After this update (0.2.10), anthropic will stream with bound tools but it will not stream tool chunks:
https://github.com/langchain-ai/langchainjs/pull/6206
@bracesproul commented on GitHub (Jul 29, 2024):
Could you expand on what you mean by this? Streams will contain tool chunks, but binding tools to the model doesn't do anything to streaming.
@bracesproul commented on GitHub (Jul 29, 2024):
Could you open a new issue for "How to stream the final result with anthropic" in the langchain-ai/langchainjs repo
@wh1pp3rz commented on GitHub (Jul 29, 2024):
Yeah this is working sort of now, the graph is streaming when tools are bound, but the streamed output contains the tool input parameters appended at the end and it looks weird for an end user. As an example, a simple multiply tool called with "what is 2 * 3?" streamed the following:
Using
streamEvents, the tool inputs are streamed under theon_chat_model_streamevent, and I don't see a way to distinguish or filter them to not be in the final output to the user.Here's the trace if that helps.