From c898a4d7ba8b3dc338b3d1c57a301333a9edb9dc Mon Sep 17 00:00:00 2001 From: BarberAlec <42246229+BarberAlec@users.noreply.github.com> Date: Tue, 19 Sep 2023 06:04:13 +0100 Subject: [PATCH] Update ContextCallbackHandler Docstring & metadata key (#10732) - **Description:** Updating URL in Context Callback Docstrings and update metadata key Context CallbackHandler uses to send model names. - **Issue:** The URL in ContextCallbackHandler is out of date. Model data being sent to Context should be under the "model" key and not "llm_model". This allows Context to do more sophisticated analysis. - **Dependencies:** None Tagging @agamble. --- libs/langchain/langchain/callbacks/context_callback.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/langchain/langchain/callbacks/context_callback.py b/libs/langchain/langchain/callbacks/context_callback.py index 12791d9119..6306763114 100644 --- a/libs/langchain/langchain/callbacks/context_callback.py +++ b/libs/langchain/langchain/callbacks/context_callback.py @@ -33,7 +33,7 @@ def import_context() -> Any: class ContextCallbackHandler(BaseCallbackHandler): """Callback Handler that records transcripts to the Context service. - (https://getcontext.ai). + (https://context.ai). Keyword Args: token (optional): The token with which to authenticate requests to Context. @@ -122,7 +122,7 @@ class ContextCallbackHandler(BaseCallbackHandler): """Run when the chat model is started.""" llm_model = kwargs.get("invocation_params", {}).get("model", None) if llm_model is not None: - self.metadata["llm_model"] = llm_model + self.metadata["model"] = llm_model if len(messages) == 0: return