mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-08 14:31:55 +00:00
community: docstrings (#23202)
Added missed docstrings. Format docstrings to the consistent format (used in the API Reference)
This commit is contained in:
@@ -42,6 +42,17 @@ ZHIPUAI_API_BASE = "https://open.bigmodel.cn/api/paas/v4/chat/completions"
|
||||
|
||||
@contextmanager
|
||||
def connect_sse(client: Any, method: str, url: str, **kwargs: Any) -> Iterator:
|
||||
"""Context manager for connecting to an SSE stream.
|
||||
|
||||
Args:
|
||||
client: The HTTP client.
|
||||
method: The HTTP method.
|
||||
url: The URL.
|
||||
**kwargs: Additional keyword arguments.
|
||||
|
||||
Yields:
|
||||
The event source.
|
||||
"""
|
||||
from httpx_sse import EventSource
|
||||
|
||||
with client.stream(method, url, **kwargs) as response:
|
||||
@@ -52,6 +63,17 @@ def connect_sse(client: Any, method: str, url: str, **kwargs: Any) -> Iterator:
|
||||
async def aconnect_sse(
|
||||
client: Any, method: str, url: str, **kwargs: Any
|
||||
) -> AsyncIterator:
|
||||
"""Async context manager for connecting to an SSE stream.
|
||||
|
||||
Args:
|
||||
client: The HTTP client.
|
||||
method: The HTTP method.
|
||||
url: The URL.
|
||||
**kwargs: Additional keyword arguments.
|
||||
|
||||
Yields:
|
||||
The event source.
|
||||
"""
|
||||
from httpx_sse import EventSource
|
||||
|
||||
async with client.stream(method, url, **kwargs) as response:
|
||||
@@ -59,7 +81,9 @@ async def aconnect_sse(
|
||||
|
||||
|
||||
def _get_jwt_token(api_key: str) -> str:
|
||||
"""Gets JWT token for ZhipuAI API, see 'https://open.bigmodel.cn/dev/api#nosdk'.
|
||||
"""Gets JWT token for ZhipuAI API.
|
||||
|
||||
See 'https://open.bigmodel.cn/dev/api#nosdk'.
|
||||
|
||||
Args:
|
||||
api_key: The API key for ZhipuAI API.
|
||||
|
Reference in New Issue
Block a user