## Description
`_parse_google_docstring` incorrectly parses multi-line argument
descriptions when a continuation line contains a colon. The continuation
line is treated as a new argument definition instead of being appended
to the current argument's description.
### Example
```python
def search(query: str, top_k: int = 5) -> str:
"""Search the knowledge base.
Args:
query: The search query to use
for finding things: important ones
top_k: Number of results to return
"""
```
**Before (broken):** The parser creates 3 args: `query`, `for finding
things`, `top_k`
**After (fixed):** The parser correctly creates 2 args: `query` (with
full description including "for finding things: important ones"),
`top_k`
### Root Cause
The parser used `if ":" in line` to detect new argument lines without
considering indentation. In Google-style docstrings, continuation lines
have deeper indentation than argument definition lines.
### Fix
Detect the base indentation level from the first argument line and treat
any line with deeper indentation as a continuation of the current
argument's description, regardless of whether it contains a colon.
## Issue
Fixes #35679
## Dependencies
None.
## Testing
Added 4 unit tests in
`test_function_calling.py::TestParseGoogleDocstring`:
- `test_continuation_line_with_colon` — the core bug scenario
- `test_simple_args_still_work` — regression check for basic args
- `test_continuation_line_without_colon` — multi-line descriptions
without colons
- `test_multiple_continuation_lines_with_colons` — multiple continuation
lines each containing colons
All tests pass locally with Python 3.12.
---------
Co-authored-by: gambletan <ethanchang32@gmail.com>
Co-authored-by: Mason Daugherty <github@mdrxy.com>
🦜🍎️ LangChain Core
Looking for the JS/TS version? Check out LangChain.js.
To help you ship LangChain apps to production faster, check out LangSmith. LangSmith is a unified developer platform for building, testing, and monitoring LLM applications.
Quick Install
uv add langchain-core
🤔 What is this?
LangChain Core contains the base abstractions that power the LangChain ecosystem.
These abstractions are designed to be as modular and simple as possible.
The benefit of having these abstractions is that any provider can implement the required interface and then easily be used in the rest of the LangChain ecosystem.
⛰️ Why build on top of LangChain Core?
The LangChain ecosystem is built on top of langchain-core. Some of the benefits:
- Modularity: We've designed Core around abstractions that are independent of each other, and not tied to any specific model provider.
- Stability: We are committed to a stable versioning scheme, and will communicate any breaking changes with advance notice and version bumps.
- Battle-tested: Core components have the largest install base in the LLM ecosystem, and are used in production by many companies.
📖 Documentation
For full documentation, see the API reference. For conceptual guides, tutorials, and examples on using LangChain, see the LangChain Docs. You can also chat with the docs using Chat LangChain.
📕 Releases & Versioning
See our Releases and Versioning policies.
💁 Contributing
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
For detailed information on how to contribute, see the Contributing Guide.
Resources
- LangChain Academy — comprehensive, free courses on LangChain libraries and products, made by the LangChain team
- Code of Conduct — community guidelines and standards