Skip to content

Commit 103b4da

Browse files
algolia-botFluf22
andcommitted
feat(specs): add transformation copilot to ingestion (generated)
algolia/api-clients-automation#3479 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Thomas Raffray <[email protected]>
1 parent 2917b58 commit 103b4da

File tree

3 files changed

+193
-0
lines changed

3 files changed

+193
-0
lines changed

algoliasearch/ingestion/client.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
from algoliasearch.ingestion.models.transformation_create_response import (
100100
TransformationCreateResponse,
101101
)
102+
from algoliasearch.ingestion.models.transformation_models import TransformationModels
102103
from algoliasearch.ingestion.models.transformation_search import TransformationSearch
103104
from algoliasearch.ingestion.models.transformation_try import TransformationTry
104105
from algoliasearch.ingestion.models.transformation_try_response import (
@@ -3149,6 +3150,48 @@ async def list_tasks_v1(
31493150
)
31503151
).deserialize(ListTasksResponseV1)
31513152

3153+
async def list_transformation_models_with_http_info(
3154+
self, request_options: Optional[Union[dict, RequestOptions]] = None
3155+
) -> ApiResponse[str]:
3156+
"""
3157+
Retrieves a list of existing LLM transformation helpers.
3158+
3159+
Required API Key ACLs:
3160+
- addObject
3161+
- deleteIndex
3162+
- editSettings
3163+
3164+
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
3165+
:return: Returns the raw algoliasearch 'APIResponse' object.
3166+
"""
3167+
3168+
return await self._transporter.request(
3169+
verb=Verb.GET,
3170+
path="/1/transformations/copilot",
3171+
request_options=self._request_options.merge(
3172+
user_request_options=request_options,
3173+
),
3174+
use_read_transporter=False,
3175+
)
3176+
3177+
async def list_transformation_models(
3178+
self, request_options: Optional[Union[dict, RequestOptions]] = None
3179+
) -> TransformationModels:
3180+
"""
3181+
Retrieves a list of existing LLM transformation helpers.
3182+
3183+
Required API Key ACLs:
3184+
- addObject
3185+
- deleteIndex
3186+
- editSettings
3187+
3188+
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
3189+
:return: Returns the deserialized response in a 'TransformationModels' result object.
3190+
"""
3191+
return (
3192+
await self.list_transformation_models_with_http_info(request_options)
3193+
).deserialize(TransformationModels)
3194+
31523195
async def list_transformations_with_http_info(
31533196
self,
31543197
items_per_page: Annotated[
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# coding: utf-8
2+
3+
"""
4+
Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
5+
"""
6+
7+
from __future__ import annotations
8+
9+
from json import loads
10+
from typing import Any, Dict, Self
11+
12+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
13+
14+
15+
class Model(BaseModel):
16+
"""
17+
Model
18+
"""
19+
20+
fullname: StrictStr
21+
model_name: StrictStr = Field(alias="modelName")
22+
system_prompt: StrictStr = Field(alias="systemPrompt")
23+
id: StrictStr
24+
provider: StrictStr
25+
26+
model_config = ConfigDict(
27+
use_enum_values=True, populate_by_name=True, validate_assignment=True
28+
)
29+
30+
def to_json(self) -> str:
31+
return self.model_dump_json(by_alias=True, exclude_unset=True)
32+
33+
@classmethod
34+
def from_json(cls, json_str: str) -> Self:
35+
"""Create an instance of Model from a JSON string"""
36+
return cls.from_dict(loads(json_str))
37+
38+
def to_dict(self) -> Dict[str, Any]:
39+
"""Return the dictionary representation of the model using alias.
40+
41+
This has the following differences from calling pydantic's
42+
`self.model_dump(by_alias=True)`:
43+
44+
* `None` is only added to the output dict for nullable fields that
45+
were set at model initialization. Other fields with value `None`
46+
are ignored.
47+
"""
48+
_dict = self.model_dump(
49+
by_alias=True,
50+
exclude={},
51+
exclude_none=True,
52+
)
53+
return _dict
54+
55+
@classmethod
56+
def from_dict(cls, obj: Dict) -> Self:
57+
"""Create an instance of Model from a dict"""
58+
if obj is None:
59+
return None
60+
61+
if not isinstance(obj, dict):
62+
return cls.model_validate(obj)
63+
64+
_obj = cls.model_validate(
65+
{
66+
"fullname": obj.get("fullname"),
67+
"modelName": obj.get("modelName"),
68+
"systemPrompt": obj.get("systemPrompt"),
69+
"id": obj.get("id"),
70+
"provider": obj.get("provider"),
71+
}
72+
)
73+
return _obj
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# coding: utf-8
2+
3+
"""
4+
Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
5+
"""
6+
7+
from __future__ import annotations
8+
9+
from json import loads
10+
from typing import Any, Dict, List, Self
11+
12+
from pydantic import BaseModel, ConfigDict
13+
14+
from algoliasearch.ingestion.models.model import Model
15+
16+
17+
class TransformationModels(BaseModel):
18+
"""
19+
List of available AI models for transformation purposes.
20+
"""
21+
22+
llms: List[Model]
23+
24+
model_config = ConfigDict(
25+
use_enum_values=True, populate_by_name=True, validate_assignment=True
26+
)
27+
28+
def to_json(self) -> str:
29+
return self.model_dump_json(by_alias=True, exclude_unset=True)
30+
31+
@classmethod
32+
def from_json(cls, json_str: str) -> Self:
33+
"""Create an instance of TransformationModels from a JSON string"""
34+
return cls.from_dict(loads(json_str))
35+
36+
def to_dict(self) -> Dict[str, Any]:
37+
"""Return the dictionary representation of the model using alias.
38+
39+
This has the following differences from calling pydantic's
40+
`self.model_dump(by_alias=True)`:
41+
42+
* `None` is only added to the output dict for nullable fields that
43+
were set at model initialization. Other fields with value `None`
44+
are ignored.
45+
"""
46+
_dict = self.model_dump(
47+
by_alias=True,
48+
exclude={},
49+
exclude_none=True,
50+
)
51+
_items = []
52+
if self.llms:
53+
for _item in self.llms:
54+
if _item:
55+
_items.append(_item.to_dict())
56+
_dict["llms"] = _items
57+
return _dict
58+
59+
@classmethod
60+
def from_dict(cls, obj: Dict) -> Self:
61+
"""Create an instance of TransformationModels from a dict"""
62+
if obj is None:
63+
return None
64+
65+
if not isinstance(obj, dict):
66+
return cls.model_validate(obj)
67+
68+
_obj = cls.model_validate(
69+
{
70+
"llms": (
71+
[Model.from_dict(_item) for _item in obj.get("llms")]
72+
if obj.get("llms") is not None
73+
else None
74+
)
75+
}
76+
)
77+
return _obj

0 commit comments

Comments
 (0)