You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,6 +68,40 @@ asyncio.run(main())
68
68
69
69
Functionality between the synchronous and asynchronous clients is otherwise identical.
70
70
71
+
### With aiohttp
72
+
73
+
By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
74
+
75
+
You can enable this by installing `aiohttp`:
76
+
77
+
```sh
78
+
# install from PyPI
79
+
pip install --pre supermemory[aiohttp]
80
+
```
81
+
82
+
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
83
+
84
+
```python
85
+
import os
86
+
import asyncio
87
+
from supermemory import DefaultAioHttpClient
88
+
from supermemory import AsyncSupermemory
89
+
90
+
91
+
asyncdefmain() -> None:
92
+
asyncwith AsyncSupermemory(
93
+
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
94
+
http_client=DefaultAioHttpClient(),
95
+
) as client:
96
+
response =await client.memories.add(
97
+
content="This is a detailed article about machine learning concepts...",
98
+
)
99
+
print(response.id)
100
+
101
+
102
+
asyncio.run(main())
103
+
```
104
+
71
105
## Using types
72
106
73
107
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
0 commit comments