Add Invocation Params (#4509)

### Add Invocation Params to Logged Run


Adds an llm type to each chat model as well as an override of the dict()
method to log the invocation parameters for each call

---------

Co-authored-by: Ankush Gola <ankush.gola@gmail.com>
This commit is contained in:
Zander Chase
2023-05-11 15:34:06 -07:00
committed by GitHub
parent 59853fc876
commit f4d3cf2dfb
6 changed files with 77 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
"""Fake Chat Model wrapper for testing purposes."""
from typing import List, Optional
from typing import Any, List, Mapping, Optional
from langchain.callbacks.manager import (
AsyncCallbackManagerForLLMRun,
@@ -30,3 +30,11 @@ class FakeChatModel(SimpleChatModel):
message = AIMessage(content=output_str)
generation = ChatGeneration(message=message)
return ChatResult(generations=[generation])
@property
def _llm_type(self) -> str:
return "fake-chat-model"
@property
def _identifying_params(self) -> Mapping[str, Any]:
return {"key": "fake"}