mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-02 03:26:17 +00:00
langchain[patch], core[patch]: Make common utils public (#13932)
- rename `langchain_core.chat_models.base._generate_from_stream` -> `generate_from_stream` - rename `langchain_core.chat_models.base._agenerate_from_stream` -> `agenerate_from_stream` - export `langchain_core.utils.utils.build_extra_kwargs` from `langchain_core.utils`
This commit is contained in:
@@ -55,7 +55,7 @@ def _get_verbosity() -> bool:
|
||||
return get_verbose()
|
||||
|
||||
|
||||
def _generate_from_stream(stream: Iterator[ChatGenerationChunk]) -> ChatResult:
|
||||
def generate_from_stream(stream: Iterator[ChatGenerationChunk]) -> ChatResult:
|
||||
generation: Optional[ChatGenerationChunk] = None
|
||||
for chunk in stream:
|
||||
if generation is None:
|
||||
@@ -66,7 +66,7 @@ def _generate_from_stream(stream: Iterator[ChatGenerationChunk]) -> ChatResult:
|
||||
return ChatResult(generations=[generation])
|
||||
|
||||
|
||||
async def _agenerate_from_stream(
|
||||
async def agenerate_from_stream(
|
||||
stream: AsyncIterator[ChatGenerationChunk],
|
||||
) -> ChatResult:
|
||||
generation: Optional[ChatGenerationChunk] = None
|
||||
|
@@ -13,6 +13,7 @@ from langchain_core.utils.input import (
|
||||
)
|
||||
from langchain_core.utils.loading import try_load_from_hub
|
||||
from langchain_core.utils.utils import (
|
||||
build_extra_kwargs,
|
||||
check_package_version,
|
||||
convert_to_secret_str,
|
||||
get_pydantic_field_names,
|
||||
@@ -37,4 +38,5 @@ __all__ = [
|
||||
"raise_for_status_with_text",
|
||||
"xor_args",
|
||||
"try_load_from_hub",
|
||||
"build_extra_kwargs",
|
||||
]
|
||||
|
@@ -15,6 +15,7 @@ EXPECTED_ALL = [
|
||||
"raise_for_status_with_text",
|
||||
"xor_args",
|
||||
"try_load_from_hub",
|
||||
"build_extra_kwargs",
|
||||
]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user