Repository navigation
Commit 9b03a75
docs: fix async pc.index() usage — it's a coroutine, must be awaited
AsyncPinecone.index() is a coroutine that resolves to AsyncIndex, but
several examples treated it as a synchronous factory. Every existing
async sample either assigned the coroutine to a local without awaiting
it (then crashed on the first method call with "'coroutine' object
has no attribute upsert/query"), or used `async with pc.index(...) as
index:` directly on the coroutine (which is also wrong — async with
needs the resolved AsyncIndex, not the coroutine).
Same bug we hit in the harness's _build_client_async_sdk2 earlier
today.
Fixes:
- README.md async quickstart: add `await` to `pc.index(host=...)`
- sync-vs-async.md: rewrite the prose ("pc.index() is a synchronous
factory method — it does not need to be awaited") which had it
exactly backwards on the async client; switch every async example
to the two-step pattern `index = await pc.index(...); async with
index: ...` for readability
Sphinx build verified clean after the change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a54d581 commit 9b03a75
2 files changed
Lines changed: 13 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
111 | | - | |
| 112 | + | |
| 113 | + | |
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
| |||
151 | 153 | | |
152 | 154 | | |
153 | 155 | | |
154 | | - | |
| 156 | + | |
| 157 | + | |
155 | 158 | | |
156 | 159 | | |
157 | 160 | | |
| |||
191 | 194 | | |
192 | 195 | | |
193 | 196 | | |
194 | | - | |
| 197 | + | |
| 198 | + | |
195 | 199 | | |
196 | 200 | | |
197 | 201 | | |
0 commit comments