googleapis / googleapis/python-aiplatform

Missing type stub for agent_engines.memories.retrieve() method

Đang mở
#6,166 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
api: vertex-ai
Ngôn ngữ chính
Python
Star
905
Fork
465
Merge trung bình
1 ngày 13 giờ
Pull request đã merge (30 ngày)
44

Mô tả

# Missing Type Stubs for `client.agent_engines.memories.retrieve()` in Google ADK

## **Description**

The `client.agent_engines.memories.retrieve()` method works correctly at runtime, but it is **missing from the type stubs**. As a result, IDEs and type checkers (Pylance, Pyright, mypy) report errors such as:

```
Cannot access attribute "retrieve" for class "_AgentEngineMemories"
```

The method itself *does* exist and functions properly during execution.

---

## **Environment**

* **google-adk version:** (run: `pip show google-adk`)
* **vertexai version:** (run: `pip show google-cloud-aiplatform`)
* **Python version:** 3.12

---

## **Steps to Reproduce**

```python
import vertexai

client = vertexai.Client(project="my-project", location="us-central1")

# Works at runtime, but IDE reports a type error
retrieved_memories = client.agent_engines.memories.retrieve(
name="projects/.../reasoningEngines/...",
scope={"app_name": "test", "user_id": "user123"},
similarity_search_params={"search_query": "*"}
)
```

---

## **Expected Behavior**

The SDK's type stubs should correctly declare the `retrieve()` method so that IDEs and type checkers do not show false errors.

---

## **Actual Behavior**

* Runtime: **works correctly**, method is available and returns results.
* Type checking: fails with errors such as:

* `Cannot access attribute "retrieve" for class "_AgentEngineMemories"`

---

## **Additional Context**

* The implementation exists in `vertexai/_genai/memories.py` (around lines 1182–1233, inside the `Memories` class).
* However, the **type stub files (.pyi)** do not expose this method.
* Other methods under `agent_engines.memories` such as `generate()`, `create()`, `list()`, and `get()` may also require type stub validation.

This issue affects static analysis and IDE tooling but not runtime functionality. A stub update should resolve it.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.