googleapis / googleapis/python-aiplatform
[Reasoning Engine] LangchainAgent.stream_query attempts to import from deprecated langchain.load path
- Lingua principale
- Python
- Stelle
- 905
- Fork
- 465
- Merge medio
- 1g 13h
- PR unite (30g)
- 44
Descrizione
#### Environment details
- OS type and version: Ubuntu 24.04.4 LTS
- Python version: `3.12.10`
- pip version: `25.2`
- `google-cloud-aiplatform` version: `Latest from main`
#### Steps to reproduce
1. Initialize a `LangchainAgent` or `LanggraphAgent` from the agent engine or reasoning engine templates.
2. Call the `query` or `stream_query` method.
3. Observe that it fails with an `ImportError` because it attempts to import from `langchain.load` instead of `langchain_core.load`.
#### Code example
```python
from vertexai.agent_engines.templates.langchain import LangchainAgent
# Initialize agent
agent = LangchainAgent(model="gemini-1.5-flash-001")
agent.set_up()
# Both query and stream_query are affected
result = agent.query(input="Hello")
for chunk in agent.stream_query(input="Hello"):
print(chunk)
```
#### Stack trace
```
Traceback (most recent call last):
File "example.py", line 8, in
for chunk in agent.stream_query(input="Hello"):
File ".../vertexai/agent_engines/templates/langchain.py", line 665, in stream_query
from langchain.load import dump as langchain_load_dump
ImportError: cannot import name 'dump' from 'langchain.load'
```
#### Affected files
The same deprecated import (`from langchain.load import dump`) exists in both `query()` and `stream_query()` across all 4 template modules:
- `vertexai/agent_engines/templates/langchain.py`
- `vertexai/agent_engines/templates/langgraph.py`
- `vertexai/preview/reasoning_engines/templates/langchain.py`
- `vertexai/preview/reasoning_engines/templates/langgraph.py`
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con query() e stream_query() nei quattro file di template interessati: vertexai/agent_engines/templates/langchain.py, langgraph.py e i template corrispondenti di preview/reasoning_engines. Confronta gli import ed esegui i test dei template oppure riproduci le chiamate a LangchainAgent e LanggraphAgent; il lavoro è completato quando entrambi i metodi non falliscono più a causa dell’import obsoleto langchain.load.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- ai, machine-learning
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 55/100