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 pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "credal"

[tool.poetry]
name = "credal"
version = "0.1.13"
version = "0.1.14"
description = ""
readme = "README.md"
authors = []
Expand Down
123 changes: 123 additions & 0 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,129 @@ client.copilots.delete_copilot(
</dl>


</dd>
</dl>
</details>

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

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Export copilot configurations for backup or migration purposes.

**IMPORTANT**: This endpoint requires:
- Admin privileges
- The 'ai-usage-analytics-log.export' scope on the API key

Returns all deployed copilots with their full configuration including model settings, tools, and deployment details. Optional date filters can be applied to narrow down results.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```python
import datetime

from credal import CredalApi

client = CredalApi(
api_key="YOUR_API_KEY",
)
client.copilots.export(
agent_created_from=datetime.datetime.fromisoformat(
"2024-01-01 00:00:00+00:00",
),
agent_created_to=datetime.datetime.fromisoformat(
"2024-12-31 23:59:59+00:00",
),
)

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**agent_created_from:** `typing.Optional[dt.datetime]` — Filter copilots created on or after this datetime (ISO 8601 format).

</dd>
</dl>

<dl>
<dd>

**agent_created_to:** `typing.Optional[dt.datetime]` — Filter copilots created before or on this datetime (ISO 8601 format).

</dd>
</dl>

<dl>
<dd>

**version_created_from:** `typing.Optional[dt.datetime]` — Filter copilot versions created on or after this datetime (ISO 8601 format).

</dd>
</dl>

<dl>
<dd>

**version_created_to:** `typing.Optional[dt.datetime]` — Filter copilot versions created before or on this datetime (ISO 8601 format).

</dd>
</dl>

<dl>
<dd>

**limit:** `typing.Optional[int]` — Maximum number of copilots to return. Must be a positive integer with a maximum value of 1000. Defaults to 100.

</dd>
</dl>

<dl>
<dd>

**cursor:** `typing.Optional[str]` — Cursor for pagination. Use the cursor returned in the previous response to fetch the next page of results. If not provided, returns the first page.

</dd>
</dl>

<dl>
<dd>

**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.

</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>
Expand Down
6 changes: 6 additions & 0 deletions src/credal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
EndOfMessageChunk,
ErrorChunk,
ErrorChunkData,
ExportCopilotsResponse,
ExportedCopilot,
FeedbackEnum,
Filter,
Filter_Boolean,
Expand Down Expand Up @@ -116,6 +118,8 @@
"EndOfMessageChunk": ".copilots",
"ErrorChunk": ".copilots",
"ErrorChunkData": ".copilots",
"ExportCopilotsResponse": ".copilots",
"ExportedCopilot": ".copilots",
"ExternalResourceId": ".common",
"FeedbackEnum": ".copilots",
"Filter": ".copilots",
Expand Down Expand Up @@ -221,6 +225,8 @@ def __dir__():
"EndOfMessageChunk",
"ErrorChunk",
"ErrorChunkData",
"ExportCopilotsResponse",
"ExportedCopilot",
"ExternalResourceId",
"FeedbackEnum",
"Filter",
Expand Down
6 changes: 6 additions & 0 deletions src/credal/copilots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
EndOfMessageChunk,
ErrorChunk,
ErrorChunkData,
ExportCopilotsResponse,
ExportedCopilot,
FeedbackEnum,
Filter,
Filter_Boolean,
Expand Down Expand Up @@ -66,6 +68,8 @@
"EndOfMessageChunk": ".types",
"ErrorChunk": ".types",
"ErrorChunkData": ".types",
"ExportCopilotsResponse": ".types",
"ExportedCopilot": ".types",
"FeedbackEnum": ".types",
"Filter": ".types",
"Filter_Boolean": ".types",
Expand Down Expand Up @@ -134,6 +138,8 @@ def __dir__():
"EndOfMessageChunk",
"ErrorChunk",
"ErrorChunkData",
"ExportCopilotsResponse",
"ExportedCopilot",
"FeedbackEnum",
"Filter",
"Filter_Boolean",
Expand Down
161 changes: 161 additions & 0 deletions src/credal/copilots/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing
import uuid

Expand All @@ -11,6 +12,7 @@
from .types.create_conversation_response import CreateConversationResponse
from .types.create_copilot_response import CreateCopilotResponse
from .types.delete_copilot_response import DeleteCopilotResponse
from .types.export_copilots_response import ExportCopilotsResponse
from .types.input_variable import InputVariable
from .types.message_feedback import MessageFeedback
from .types.send_agent_message_response import SendAgentMessageResponse
Expand Down Expand Up @@ -552,6 +554,82 @@ def delete_copilot(
_response = self._raw_client.delete_copilot(id=id, request_options=request_options)
return _response.data

def export(
self,
*,
agent_created_from: typing.Optional[dt.datetime] = OMIT,
agent_created_to: typing.Optional[dt.datetime] = OMIT,
version_created_from: typing.Optional[dt.datetime] = OMIT,
version_created_to: typing.Optional[dt.datetime] = OMIT,
limit: typing.Optional[int] = OMIT,
cursor: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> ExportCopilotsResponse:
"""
Export copilot configurations for backup or migration purposes.

**IMPORTANT**: This endpoint requires:
- Admin privileges
- The 'ai-usage-analytics-log.export' scope on the API key

Returns all deployed copilots with their full configuration including model settings, tools, and deployment details. Optional date filters can be applied to narrow down results.

Parameters
----------
agent_created_from : typing.Optional[dt.datetime]
Filter copilots created on or after this datetime (ISO 8601 format).

agent_created_to : typing.Optional[dt.datetime]
Filter copilots created before or on this datetime (ISO 8601 format).

version_created_from : typing.Optional[dt.datetime]
Filter copilot versions created on or after this datetime (ISO 8601 format).

version_created_to : typing.Optional[dt.datetime]
Filter copilot versions created before or on this datetime (ISO 8601 format).

limit : typing.Optional[int]
Maximum number of copilots to return. Must be a positive integer with a maximum value of 1000. Defaults to 100.

cursor : typing.Optional[str]
Cursor for pagination. Use the cursor returned in the previous response to fetch the next page of results. If not provided, returns the first page.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Returns
-------
ExportCopilotsResponse

Examples
--------
import datetime

from credal import CredalApi

client = CredalApi(
api_key="YOUR_API_KEY",
)
client.copilots.export(
agent_created_from=datetime.datetime.fromisoformat(
"2024-01-01 00:00:00+00:00",
),
agent_created_to=datetime.datetime.fromisoformat(
"2024-12-31 23:59:59+00:00",
),
)
"""
_response = self._raw_client.export(
agent_created_from=agent_created_from,
agent_created_to=agent_created_to,
version_created_from=version_created_from,
version_created_to=version_created_to,
limit=limit,
cursor=cursor,
request_options=request_options,
)
return _response.data


class AsyncCopilotsClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
Expand Down Expand Up @@ -1149,3 +1227,86 @@ async def main() -> None:
"""
_response = await self._raw_client.delete_copilot(id=id, request_options=request_options)
return _response.data

async def export(
self,
*,
agent_created_from: typing.Optional[dt.datetime] = OMIT,
agent_created_to: typing.Optional[dt.datetime] = OMIT,
version_created_from: typing.Optional[dt.datetime] = OMIT,
version_created_to: typing.Optional[dt.datetime] = OMIT,
limit: typing.Optional[int] = OMIT,
cursor: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> ExportCopilotsResponse:
"""
Export copilot configurations for backup or migration purposes.

**IMPORTANT**: This endpoint requires:
- Admin privileges
- The 'ai-usage-analytics-log.export' scope on the API key

Returns all deployed copilots with their full configuration including model settings, tools, and deployment details. Optional date filters can be applied to narrow down results.

Parameters
----------
agent_created_from : typing.Optional[dt.datetime]
Filter copilots created on or after this datetime (ISO 8601 format).

agent_created_to : typing.Optional[dt.datetime]
Filter copilots created before or on this datetime (ISO 8601 format).

version_created_from : typing.Optional[dt.datetime]
Filter copilot versions created on or after this datetime (ISO 8601 format).

version_created_to : typing.Optional[dt.datetime]
Filter copilot versions created before or on this datetime (ISO 8601 format).

limit : typing.Optional[int]
Maximum number of copilots to return. Must be a positive integer with a maximum value of 1000. Defaults to 100.

cursor : typing.Optional[str]
Cursor for pagination. Use the cursor returned in the previous response to fetch the next page of results. If not provided, returns the first page.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Returns
-------
ExportCopilotsResponse

Examples
--------
import asyncio
import datetime

from credal import AsyncCredalApi

client = AsyncCredalApi(
api_key="YOUR_API_KEY",
)


async def main() -> None:
await client.copilots.export(
agent_created_from=datetime.datetime.fromisoformat(
"2024-01-01 00:00:00+00:00",
),
agent_created_to=datetime.datetime.fromisoformat(
"2024-12-31 23:59:59+00:00",
),
)


asyncio.run(main())
"""
_response = await self._raw_client.export(
agent_created_from=agent_created_from,
agent_created_to=agent_created_to,
version_created_from=version_created_from,
version_created_to=version_created_to,
limit=limit,
cursor=cursor,
request_options=request_options,
)
return _response.data
Loading