mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 18:50:33 +00:00
- Switch `TestHuggingFaceEndpoint` from `Llama-4-Maverick` + `fireworks-ai` to `Llama-3.3-70B-Instruct` + `sambanova` — Maverick is no longer routed to Fireworks in hub 1.x - Switch `test_stream_usage` provider from `nebius` to `scaleway` for `gemma-3-27b-it` — same provider routing change
23 lines
753 B
Python
23 lines
753 B
Python
from langchain_core.messages import AIMessageChunk
|
|
|
|
from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint
|
|
|
|
|
|
def test_stream_usage() -> None:
|
|
"""Test we are able to configure stream options on models that require it."""
|
|
llm = HuggingFaceEndpoint( # type: ignore[call-arg] # (model is inferred in class)
|
|
repo_id="google/gemma-3-27b-it",
|
|
task="conversational",
|
|
provider="scaleway",
|
|
)
|
|
|
|
model = ChatHuggingFace(llm=llm, stream_usage=True)
|
|
|
|
full: AIMessageChunk | None = None
|
|
for chunk in model.stream("hello"):
|
|
assert isinstance(chunk, AIMessageChunk)
|
|
full = chunk if full is None else full + chunk
|
|
|
|
assert isinstance(full, AIMessageChunk)
|
|
assert full.usage_metadata
|