You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/libs/core/tests/unit_tests/runnables
ccurme 181dfef118
core, standard tests, partner packages: add test for model params (#21677)
1. Adds `.get_ls_params` to BaseChatModel which returns
```python
class LangSmithParams(TypedDict, total=False):
    ls_provider: str
    ls_model_name: str
    ls_model_type: Literal["chat"]
    ls_temperature: Optional[float]
    ls_max_tokens: Optional[int]
    ls_stop: Optional[List[str]]
```
by default it will only return
```python
{ls_model_type="chat", ls_stop=stop}
```

2. Add these params to inheritable metadata in
`CallbackManager.configure`

3. Implement `.get_ls_params` and populate all params for Anthropic +
all subclasses of BaseChatOpenAI

Sample trace:
https://smith.langchain.com/public/d2962673-4c83-47c7-b51e-61d07aaffb1b/r

**OpenAI**:
<img width="984" alt="Screenshot 2024-05-17 at 10 03 35 AM"
src="https://github.com/langchain-ai/langchain/assets/26529506/2ef41f74-a9df-4e0e-905d-da74fa82a910">

**Anthropic**:
<img width="978" alt="Screenshot 2024-05-17 at 10 06 07 AM"
src="https://github.com/langchain-ai/langchain/assets/26529506/39701c9f-7da5-4f1a-ab14-84e9169d63e7">

**Mistral** (and all others for which params are not yet populated):
<img width="977" alt="Screenshot 2024-05-17 at 10 08 43 AM"
src="https://github.com/langchain-ai/langchain/assets/26529506/37d7d894-fec2-4300-986f-49a5f0191b03">
4 months ago
..
__snapshots__ core, standard tests, partner packages: add test for model params (#21677) 4 months ago
__init__.py REFACTOR: Refactor langchain_core (#13627) 10 months ago
test_config.py core[patch]: fix arbitrary config keys (#18827) 7 months ago
test_configurable.py Fix getattr in runnable binding for cases where config is passed in as arg too (#20528) 5 months ago
test_context.py core[minor]: moved fake llms and embeddings to core (#19226) 6 months ago
test_fallbacks.py core[minor]: moved fake llms and embeddings to core (#19226) 6 months ago
test_graph.py Runnable graph viz improvements (#20529) 5 months ago
test_history.py support messages in messages out (#20862) 5 months ago
test_imports.py Fetch runnable config from context var inside runnable lambda and runnable generator (#15334) 9 months ago
test_runnable.py [Core] Check is async callable (#21714) 4 months ago
test_runnable_events_v1.py core, standard tests, partner packages: add test for model params (#21677) 4 months ago
test_runnable_events_v2.py core, standard tests, partner packages: add test for model params (#21677) 4 months ago
test_utils.py core: fix attributeerror in runnablelambda.deps (#20569) 5 months ago