Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"cliVersion": "3.27.0",
"generatorName": "fernapi/fern-python-sdk",
"generatorVersion": "4.41.3"
"generatorVersion": "4.46.3"
}
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[project]
name = "credal"
dynamic = ["version"]

[tool.poetry]
name = "credal"
Expand Down
44 changes: 22 additions & 22 deletions reference.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Reference
## Copilots
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">create_copilot</a>(...)</code></summary>
<details><summary><code>client.copilots.<a href="src/credal/copilots/client.py">create_copilot</a>(...) -> AsyncHttpResponse[CreateCopilotResponse]</code></summary>
<dl>
<dd>

Expand Down Expand Up @@ -94,7 +94,7 @@ client.copilots.create_copilot(
</dl>
</details>

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

Expand Down Expand Up @@ -177,7 +177,7 @@ client.copilots.create_conversation(
</dl>
</details>

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

Expand Down Expand Up @@ -271,7 +271,7 @@ client.copilots.provide_message_feedback(
</dl>
</details>

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

Expand Down Expand Up @@ -387,7 +387,7 @@ client.copilots.send_message(
</dl>
</details>

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

Expand Down Expand Up @@ -519,7 +519,7 @@ for chunk in response.data:
</dl>
</details>

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

Expand Down Expand Up @@ -604,7 +604,7 @@ client.copilots.add_collection_to_copilot(
</dl>
</details>

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

Expand Down Expand Up @@ -689,7 +689,7 @@ client.copilots.remove_collection_from_copilot(
</dl>
</details>

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

Expand Down Expand Up @@ -781,7 +781,7 @@ client.copilots.update_configuration(
</dl>
</details>

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

Expand Down Expand Up @@ -841,7 +841,7 @@ client.copilots.delete_copilot(
</dl>
</details>

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

Expand Down Expand Up @@ -965,7 +965,7 @@ client.copilots.export(
</details>

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

Expand Down Expand Up @@ -1105,7 +1105,7 @@ client.document_catalog.upload_document_contents(
</dl>
</details>

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

Expand Down Expand Up @@ -1184,7 +1184,7 @@ client.document_catalog.sync_source_by_url(
</dl>
</details>

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

Expand Down Expand Up @@ -1281,7 +1281,7 @@ client.document_catalog.metadata(
</details>

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

Expand Down Expand Up @@ -1374,7 +1374,7 @@ client.document_collections.add_documents_to_collection(
</dl>
</details>

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

Expand Down Expand Up @@ -1467,7 +1467,7 @@ client.document_collections.remove_documents_from_collection(
</dl>
</details>

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

Expand Down Expand Up @@ -1541,7 +1541,7 @@ client.document_collections.list_documents_in_collection(
</dl>
</details>

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

Expand Down Expand Up @@ -1635,7 +1635,7 @@ client.document_collections.create_collection(
</dl>
</details>

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

Expand Down Expand Up @@ -1709,7 +1709,7 @@ client.document_collections.delete_collection(
</dl>
</details>

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

Expand Down Expand Up @@ -1815,7 +1815,7 @@ client.document_collections.create_mongo_collection_sync(
</dl>
</details>

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

Expand Down Expand Up @@ -1924,7 +1924,7 @@ client.document_collections.update_mongo_collection_sync(
</details>

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

Expand Down Expand Up @@ -2057,7 +2057,7 @@ client.search.search_document_collection(
</details>

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

Expand Down
10 changes: 10 additions & 0 deletions src/credal/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,22 @@ def __init__(
headers: typing.Optional[typing.Dict[str, str]] = None,
base_url: str,
timeout: typing.Optional[float] = None,
async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None,
httpx_client: httpx.AsyncClient,
):
super().__init__(api_key=api_key, headers=headers, base_url=base_url, timeout=timeout)
self._async_token = async_token
self.httpx_client = AsyncHttpClient(
httpx_client=httpx_client,
base_headers=self.get_headers,
base_timeout=self.get_timeout,
base_url=self.get_base_url,
async_base_headers=self.async_get_headers,
)

async def async_get_headers(self) -> typing.Dict[str, str]:
headers = self.get_headers()
if self._async_token is not None:
token = await self._async_token()
headers["Authorization"] = f"Bearer {token}"
return headers
Loading