googleapis / googleapis/python-aiplatform

Bug: `async_stream_query` not async

Aperta
#5,773 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
api: vertex-ai
Lingua principale
Python
Stelle
905
Fork
465
Merge medio
1g 13h
PR unite (30g)
44

Descrizione

#### Environment details

- OS type and version: Linux 6.6.87.2-microsoft-standard-WSL2
- Python version: Python 3.11.9
- pip version: pip 25.2
- `google-cloud-aiplatform` version: 1.111.0

#### Steps to reproduce

1. Deploy a simple adk agent.
2. Run multiple async functions to call the agent's `async_stream_query` method.

#### Code example

```python
async def run_query(app, uid):
prompt = 'some prompts have delayed responses'
session = await app.async_create_session(user_id=uid)
async for event in app.async_stream_query(
user_id=uid,
session_id=session['id'],
message=prompt,
):
print(event)
await app.async_delete_session(user_id=uid, session_id=session['id'])

async def run():
agent = agent_engines.get(AGENT_ID)
await asyncio.gather(
run_query(agent, 'u1'),
run_query(agent, 'u2'),
run_query(agent, 'u3'),
)

if __name__ == '__main__':
asyncio.run(run())
```

#### Result

The requests are not sent concurrently to the Vertex AI Agent Engine.

Image

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.