LangSmithRunChatLoader#
- class langchain_community.chat_loaders.langsmith.LangSmithRunChatLoader(runs: Iterable[str | Run], client: 'Client' | None = None)[source]#
Load chat sessions from a list of LangSmith βllmβ runs.
- client#
Instance of LangSmith client for fetching data.
- Type:
Client
Initialize a new LangSmithRunChatLoader instance.
- Parameters:
runs (Iterable[Union[str, Run]]) β List of LLM run IDs or run objects.
client (Optional['Client']) β An instance of LangSmith client, if not provided, a new client instance will be created.
Methods
__init__
(runs[,Β client])Initialize a new LangSmithRunChatLoader instance.
Lazy load the chat sessions from the iterable of run IDs.
load
()Eagerly load the chat sessions into memory.
- __init__(runs: Iterable[str | Run], client: 'Client' | None = None)[source]#
Initialize a new LangSmithRunChatLoader instance.
- Parameters:
runs (Iterable[Union[str, Run]]) β List of LLM run IDs or run objects.
client (Optional['Client']) β An instance of LangSmith client, if not provided, a new client instance will be created.
- lazy_load() Iterator[ChatSession] [source]#
Lazy load the chat sessions from the iterable of run IDs.
This method fetches the runs and converts them to chat sessions on-the-fly, yielding one session at a time.
- Returns:
Iterator of chat sessions containing messages.
- Return type:
Iterator[ChatSession]
- load() List[ChatSession] #
Eagerly load the chat sessions into memory.
- Returns:
A list of chat sessions.
- Return type:
List[ChatSession]
Examples using LangSmithRunChatLoader