mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
feat(core): mint langchain-model-profiles and add profile property to BaseChatModel (#33728)
This commit is contained in:
66
libs/model-profiles/README.md
Normal file
66
libs/model-profiles/README.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# 🦜🪪 langchain-model-profiles
|
||||
|
||||
[](https://pypi.org/project/langchain-model-profiles/#history)
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://pypistats.org/packages/langchain-model-profiles)
|
||||
[](https://twitter.com/langchainai)
|
||||
|
||||
> [!WARNING]
|
||||
> This package is currently in development and the API is subject to change.
|
||||
|
||||
Centralized reference of LLM capabilities for LangChain chat models.
|
||||
|
||||
## Overview
|
||||
|
||||
`langchain-model-profiles` enables programmatic access to model capabilities through a `.profile` property on LangChain chat models.
|
||||
|
||||
This allows you to query model-specific features such as context window sizes, supported input/output modalities, structured output support, tool calling capabilities, and more.
|
||||
|
||||
## Data sources
|
||||
|
||||
This package is built on top of the excellent work by the [models.dev](https://github.com/sst/models.dev) project, an open source initiative that provides model capability data.
|
||||
|
||||
This package augments the data from models.dev with some additional fields. We intend to keep this aligned with the upstream project as it evolves.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install "langchain[model-profiles]"
|
||||
```
|
||||
|
||||
Or with uv:
|
||||
|
||||
```bash
|
||||
uv add "langchain[model-profiles]"
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Access model capabilities through the `.profile` property on any LangChain chat model:
|
||||
|
||||
```python
|
||||
# pip install "langchain[openai]"
|
||||
|
||||
from langchain.chat_models import init_chat_model
|
||||
|
||||
model = init_chat_model("openai:gpt-5")
|
||||
profile = model.profile
|
||||
|
||||
# Check specific capabilities
|
||||
if profile.get("structured_output"):
|
||||
print(f"This model supports a dedicated structured output feature.")
|
||||
|
||||
if profile.get("max_input_tokens"):
|
||||
print(f"Max input tokens: {profile.get('max_input_tokens')}")
|
||||
|
||||
if profile.get("..."):
|
||||
...
|
||||
```
|
||||
|
||||
## Available fields
|
||||
|
||||
See `ModelProfile` in [`model_profile.py`](./langchain_model_profiles/model_profile.py) for the full list of available fields and their descriptions.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
Reference in New Issue
Block a user