Skip to content

Commit de4a8a0

Browse files
SDK regeneration (#68)
Co-authored-by: fern-api[bot] <115122769+fern-api[bot]@users.noreply.github.com>
1 parent 4b377a0 commit de4a8a0

File tree

6 files changed

+317
-109
lines changed

6 files changed

+317
-109
lines changed

.fern/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"cliVersion": "3.27.0",
33
"generatorName": "fernapi/fern-python-sdk",
4-
"generatorVersion": "4.41.3"
4+
"generatorVersion": "4.46.3"
55
}

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[project]
22
name = "credal"
3+
dynamic = ["version"]
34

45
[tool.poetry]
56
name = "credal"

reference.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Reference
22
## Copilots
3-
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">create_copilot</a>(...)</code></summary>
3+
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">create_copilot</a>(...) -> AsyncHttpResponse[CreateCopilotResponse]</code></summary>
44
<dl>
55
<dd>
66

@@ -94,7 +94,7 @@ client.copilots.create_copilot(
9494
</dl>
9595
</details>
9696

97-
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">create_conversation</a>(...)</code></summary>
97+
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">create_conversation</a>(...) -> AsyncHttpResponse[CreateConversationResponse]</code></summary>
9898
<dl>
9999
<dd>
100100

@@ -177,7 +177,7 @@ client.copilots.create_conversation(
177177
</dl>
178178
</details>
179179

180-
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">provide_message_feedback</a>(...)</code></summary>
180+
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">provide_message_feedback</a>(...) -> AsyncHttpResponse[None]</code></summary>
181181
<dl>
182182
<dd>
183183

@@ -271,7 +271,7 @@ client.copilots.provide_message_feedback(
271271
</dl>
272272
</details>
273273

274-
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">send_message</a>(...)</code></summary>
274+
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">send_message</a>(...) -> AsyncHttpResponse[SendAgentMessageResponse]</code></summary>
275275
<dl>
276276
<dd>
277277

@@ -387,7 +387,7 @@ client.copilots.send_message(
387387
</dl>
388388
</details>
389389

390-
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">stream_message</a>(...)</code></summary>
390+
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">stream_message</a>(...) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[StreamingChunk]]]</code></summary>
391391
<dl>
392392
<dd>
393393

@@ -519,7 +519,7 @@ for chunk in response.data:
519519
</dl>
520520
</details>
521521

522-
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">add_collection_to_copilot</a>(...)</code></summary>
522+
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">add_collection_to_copilot</a>(...) -> AsyncHttpResponse[None]</code></summary>
523523
<dl>
524524
<dd>
525525

@@ -604,7 +604,7 @@ client.copilots.add_collection_to_copilot(
604604
</dl>
605605
</details>
606606

607-
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">remove_collection_from_copilot</a>(...)</code></summary>
607+
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">remove_collection_from_copilot</a>(...) -> AsyncHttpResponse[None]</code></summary>
608608
<dl>
609609
<dd>
610610

@@ -689,7 +689,7 @@ client.copilots.remove_collection_from_copilot(
689689
</dl>
690690
</details>
691691

692-
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">update_configuration</a>(...)</code></summary>
692+
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">update_configuration</a>(...) -> AsyncHttpResponse[None]</code></summary>
693693
<dl>
694694
<dd>
695695

@@ -781,7 +781,7 @@ client.copilots.update_configuration(
781781
</dl>
782782
</details>
783783

784-
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">delete_copilot</a>(...)</code></summary>
784+
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">delete_copilot</a>(...) -> AsyncHttpResponse[DeleteCopilotResponse]</code></summary>
785785
<dl>
786786
<dd>
787787

@@ -841,7 +841,7 @@ client.copilots.delete_copilot(
841841
</dl>
842842
</details>
843843

844-
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">export</a>(...)</code></summary>
844+
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">export</a>(...) -> AsyncHttpResponse[ExportCopilotsResponse]</code></summary>
845845
<dl>
846846
<dd>
847847

@@ -965,7 +965,7 @@ client.copilots.export(
965965
</details>
966966

967967
## DocumentCatalog
968-
<details><summary><code>client.document_catalog.<a href="src/credal/document_catalog/client.py">upload_document_contents</a>(...)</code></summary>
968+
<details><summary><code>client.document_catalog.<a href="src/credal/document_catalog/client.py">upload_document_contents</a>(...) -> AsyncHttpResponse[UploadDocumentResponse]</code></summary>
969969
<dl>
970970
<dd>
971971

@@ -1105,7 +1105,7 @@ client.document_catalog.upload_document_contents(
11051105
</dl>
11061106
</details>
11071107

1108-
<details><summary><code>client.document_catalog.<a href="src/credal/document_catalog/client.py">sync_source_by_url</a>(...)</code></summary>
1108+
<details><summary><code>client.document_catalog.<a href="src/credal/document_catalog/client.py">sync_source_by_url</a>(...) -> AsyncHttpResponse[SyncSourceByUrlResponse]</code></summary>
11091109
<dl>
11101110
<dd>
11111111

@@ -1184,7 +1184,7 @@ client.document_catalog.sync_source_by_url(
11841184
</dl>
11851185
</details>
11861186

1187-
<details><summary><code>client.document_catalog.<a href="src/credal/document_catalog/client.py">metadata</a>(...)</code></summary>
1187+
<details><summary><code>client.document_catalog.<a href="src/credal/document_catalog/client.py">metadata</a>(...) -> AsyncHttpResponse[None]</code></summary>
11881188
<dl>
11891189
<dd>
11901190

@@ -1281,7 +1281,7 @@ client.document_catalog.metadata(
12811281
</details>
12821282

12831283
## DocumentCollections
1284-
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">add_documents_to_collection</a>(...)</code></summary>
1284+
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">add_documents_to_collection</a>(...) -> AsyncHttpResponse[None]</code></summary>
12851285
<dl>
12861286
<dd>
12871287

@@ -1374,7 +1374,7 @@ client.document_collections.add_documents_to_collection(
13741374
</dl>
13751375
</details>
13761376

1377-
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">remove_documents_from_collection</a>(...)</code></summary>
1377+
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">remove_documents_from_collection</a>(...) -> AsyncHttpResponse[None]</code></summary>
13781378
<dl>
13791379
<dd>
13801380

@@ -1467,7 +1467,7 @@ client.document_collections.remove_documents_from_collection(
14671467
</dl>
14681468
</details>
14691469

1470-
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">list_documents_in_collection</a>(...)</code></summary>
1470+
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">list_documents_in_collection</a>(...) -> AsyncHttpResponse[ListDocumentsInCollectionResponse]</code></summary>
14711471
<dl>
14721472
<dd>
14731473

@@ -1541,7 +1541,7 @@ client.document_collections.list_documents_in_collection(
15411541
</dl>
15421542
</details>
15431543

1544-
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">create_collection</a>(...)</code></summary>
1544+
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">create_collection</a>(...) -> AsyncHttpResponse[CreateCollectionResponse]</code></summary>
15451545
<dl>
15461546
<dd>
15471547

@@ -1635,7 +1635,7 @@ client.document_collections.create_collection(
16351635
</dl>
16361636
</details>
16371637

1638-
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">delete_collection</a>(...)</code></summary>
1638+
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">delete_collection</a>(...) -> AsyncHttpResponse[DeleteCollectionResponse]</code></summary>
16391639
<dl>
16401640
<dd>
16411641

@@ -1709,7 +1709,7 @@ client.document_collections.delete_collection(
17091709
</dl>
17101710
</details>
17111711

1712-
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">create_mongo_collection_sync</a>(...)</code></summary>
1712+
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">create_mongo_collection_sync</a>(...) -> AsyncHttpResponse[MongoCollectionSyncResponse]</code></summary>
17131713
<dl>
17141714
<dd>
17151715

@@ -1815,7 +1815,7 @@ client.document_collections.create_mongo_collection_sync(
18151815
</dl>
18161816
</details>
18171817

1818-
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">update_mongo_collection_sync</a>(...)</code></summary>
1818+
<details><summary><code>client.document_collections.<a href="src/credal/document_collections/client.py">update_mongo_collection_sync</a>(...) -> AsyncHttpResponse[MongoCollectionSyncResponse]</code></summary>
18191819
<dl>
18201820
<dd>
18211821

@@ -1924,7 +1924,7 @@ client.document_collections.update_mongo_collection_sync(
19241924
</details>
19251925

19261926
## Search
1927-
<details><summary><code>client.search.<a href="src/credal/search/client.py">search_document_collection</a>(...)</code></summary>
1927+
<details><summary><code>client.search.<a href="src/credal/search/client.py">search_document_collection</a>(...) -> AsyncHttpResponse[SearchDocumentCollectionResponse]</code></summary>
19281928
<dl>
19291929
<dd>
19301930

@@ -2057,7 +2057,7 @@ client.search.search_document_collection(
20572057
</details>
20582058

20592059
## Users
2060-
<details><summary><code>client.users.<a href="src/credal/users/client.py">metadata</a>(...)</code></summary>
2060+
<details><summary><code>client.users.<a href="src/credal/users/client.py">metadata</a>(...) -> AsyncHttpResponse[None]</code></summary>
20612061
<dl>
20622062
<dd>
20632063

src/credal/core/client_wrapper.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,22 @@ def __init__(
7474
headers: typing.Optional[typing.Dict[str, str]] = None,
7575
base_url: str,
7676
timeout: typing.Optional[float] = None,
77+
async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None,
7778
httpx_client: httpx.AsyncClient,
7879
):
7980
super().__init__(api_key=api_key, headers=headers, base_url=base_url, timeout=timeout)
81+
self._async_token = async_token
8082
self.httpx_client = AsyncHttpClient(
8183
httpx_client=httpx_client,
8284
base_headers=self.get_headers,
8385
base_timeout=self.get_timeout,
8486
base_url=self.get_base_url,
87+
async_base_headers=self.async_get_headers,
8588
)
89+
90+
async def async_get_headers(self) -> typing.Dict[str, str]:
91+
headers = self.get_headers()
92+
if self._async_token is not None:
93+
token = await self._async_token()
94+
headers["Authorization"] = f"Bearer {token}"
95+
return headers

0 commit comments

Comments
 (0)