_convert_from_v1_to_mistral() — langchain Function Reference
Architecture documentation for the _convert_from_v1_to_mistral() function in _compat.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD f7fe73b7_ae4a_d4c5_8fba_769a157a044b["_convert_from_v1_to_mistral()"] 93f8f3a4_a00a_3cbb_6048_6799a3ca5301["_compat.py"] f7fe73b7_ae4a_d4c5_8fba_769a157a044b -->|defined in| 93f8f3a4_a00a_3cbb_6048_6799a3ca5301 style f7fe73b7_ae4a_d4c5_8fba_769a157a044b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/mistralai/langchain_mistralai/_compat.py lines 10–43
def _convert_from_v1_to_mistral(
content: list[types.ContentBlock],
model_provider: str | None,
) -> str | list[str | dict]:
new_content: list = []
for block in content:
if block["type"] == "text":
new_content.append({"text": block.get("text", ""), "type": "text"})
elif (
block["type"] == "reasoning"
and (reasoning := block.get("reasoning"))
and isinstance(reasoning, str)
and model_provider == "mistralai"
):
new_content.append(
{
"type": "thinking",
"thinking": [{"type": "text", "text": reasoning}],
}
)
elif (
block["type"] == "non_standard"
and "value" in block
and model_provider == "mistralai"
):
new_content.append(block["value"])
elif block["type"] == "tool_call":
continue
else:
new_content.append(block)
return new_content
Domain
Subdomains
Source
Frequently Asked Questions
What does _convert_from_v1_to_mistral() do?
_convert_from_v1_to_mistral() is a function in the langchain codebase, defined in libs/partners/mistralai/langchain_mistralai/_compat.py.
Where is _convert_from_v1_to_mistral() defined?
_convert_from_v1_to_mistral() is defined in libs/partners/mistralai/langchain_mistralai/_compat.py at line 10.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free