qanswer_sdk 3.1213.0__py3-none-any.whl → 3.1244.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qanswer_sdk/__init__.py +66 -43
- qanswer_sdk/api/__init__.py +7 -4
- qanswer_sdk/api/admin_api.py +590 -7695
- qanswer_sdk/api/ai_assistant_access_rights_api.py +72 -73
- qanswer_sdk/api/ai_assistant_api.py +567 -46
- qanswer_sdk/api/branding_api.py +4578 -0
- qanswer_sdk/api/chatbot_api.py +72 -87
- qanswer_sdk/api/{tag_api.py → connector_imap_connector_api.py} +415 -997
- qanswer_sdk/api/connector_rdf_api.py +30 -31
- qanswer_sdk/api/connectors_api.py +183 -166
- qanswer_sdk/api/connectors_data_api.py +345 -1
- qanswer_sdk/api/dataset_config_api.py +0 -245
- qanswer_sdk/api/llm_api.py +30 -30
- qanswer_sdk/api/payment_api.py +17 -16
- qanswer_sdk/api/speech_to_text_api.py +2 -2
- qanswer_sdk/api/task_chat_api.py +8 -7
- qanswer_sdk/api/task_rdf_linker_api.py +35 -36
- qanswer_sdk/api/task_rdf_sparql_endpoint_api.py +16 -16
- qanswer_sdk/api/task_report_copilot_api.py +895 -281
- qanswer_sdk/api/task_search_api.py +8 -7
- qanswer_sdk/api/tool_embedder_api.py +4040 -0
- qanswer_sdk/api/{user_api.py → tool_llm_api.py} +735 -2749
- qanswer_sdk/api/unit_organizations_api.py +4547 -0
- qanswer_sdk/api/unit_teams_api.py +3906 -0
- qanswer_sdk/api/{organizations_teams_api.py → unit_user_api.py} +1345 -1394
- qanswer_sdk/api_client.py +1 -1
- qanswer_sdk/configuration.py +1 -1
- qanswer_sdk/models/__init__.py +58 -38
- qanswer_sdk/models/aggregation.py +2 -2
- qanswer_sdk/models/ai_assistant_filter_dto.py +105 -0
- qanswer_sdk/models/{user_profile_paginated.py → ai_assistant_list.py} +18 -18
- qanswer_sdk/models/{embedding_model.py → available_aggregation.py} +13 -11
- qanswer_sdk/models/available_connectors_response.py +2 -2
- qanswer_sdk/models/{branding_data.py → branding_app_title.py} +4 -4
- qanswer_sdk/models/{api_response.py → branding_system_message.py} +8 -8
- qanswer_sdk/models/chat_task_settings.py +12 -12
- qanswer_sdk/models/chat_task_update.py +13 -5
- qanswer_sdk/models/chatbot_chat_payload.py +19 -2
- qanswer_sdk/models/chatbot_conversation_model.py +10 -0
- qanswer_sdk/models/chatbot_response.py +22 -2
- qanswer_sdk/models/{user_chatbot_setting_payload.py → chatbot_setting_dto.py} +12 -13
- qanswer_sdk/models/chatbot_setting_request.py +96 -0
- qanswer_sdk/models/{question_completion.py → clip_connector_file_structure.py} +9 -9
- qanswer_sdk/models/clip_connector_structure.py +97 -0
- qanswer_sdk/models/connector_model.py +2 -2
- qanswer_sdk/models/conversation_message.py +4 -12
- qanswer_sdk/models/{cost_summary.py → cost_summary_dto.py} +4 -4
- qanswer_sdk/models/create_connector_request.py +4 -2
- qanswer_sdk/models/create_imap_connector_request.py +105 -0
- qanswer_sdk/models/create_pinecone_connector_request.py +3 -1
- qanswer_sdk/models/create_sharepoint_connector_from_certificate_request.py +3 -1
- qanswer_sdk/models/create_sharepoint_connector_request.py +3 -1
- qanswer_sdk/models/dataset_detail_kg.py +27 -1
- qanswer_sdk/models/dataset_schema.py +4 -2
- qanswer_sdk/models/dataset_update_object.py +3 -1
- qanswer_sdk/models/delete_connector_model.py +2 -2
- qanswer_sdk/models/delete_connectors_response.py +2 -4
- qanswer_sdk/models/{json_nullable_source_metadata.py → duplicate_report_template_response.py} +11 -9
- qanswer_sdk/models/{json_nullable_file_failure_reason.py → email_folder.py} +12 -8
- qanswer_sdk/models/{embedding_endpoint.py → embedder_detailed_dto.py} +16 -8
- qanswer_sdk/models/{tag_payload.py → embedder_dto.py} +11 -7
- qanswer_sdk/models/{pageable_object.py → embedder_list_dto.py} +20 -20
- qanswer_sdk/models/embedding_endpoint_create.py +3 -1
- qanswer_sdk/models/embedding_endpoint_update.py +4 -2
- qanswer_sdk/models/{sort_object.py → entity_description.py} +16 -12
- qanswer_sdk/models/{dataset_description.py → entity_description_dto.py} +9 -7
- qanswer_sdk/models/file_model.py +2 -2
- qanswer_sdk/models/imap_add_payload.py +103 -0
- qanswer_sdk/models/imap_additional_fields.py +101 -0
- qanswer_sdk/models/imap_file_metadata.py +114 -0
- qanswer_sdk/models/imap_search_response.py +113 -0
- qanswer_sdk/models/llm.py +129 -0
- qanswer_sdk/models/llm_consumption.py +118 -0
- qanswer_sdk/models/{pageable.py → llm_context_ranges.py} +14 -13
- qanswer_sdk/models/{llm_cost.py → llm_cost_filter.py} +11 -7
- qanswer_sdk/models/llm_cost_list.py +101 -0
- qanswer_sdk/models/llm_detailed_dto.py +179 -0
- qanswer_sdk/models/{llm_details.py → llm_dto.py} +14 -18
- qanswer_sdk/models/llm_endpoint.py +8 -2
- qanswer_sdk/models/llm_endpoint_read_input.py +173 -0
- qanswer_sdk/models/llm_endpoint_read_output.py +173 -0
- qanswer_sdk/models/llm_filter_dto.py +99 -0
- qanswer_sdk/models/llm_list_detailed_dto.py +101 -0
- qanswer_sdk/models/llm_list_dto.py +101 -0
- qanswer_sdk/models/modify_connector_request.py +5 -11
- qanswer_sdk/models/{o_auth_service.py → o_auth_service_dto.py} +4 -4
- qanswer_sdk/models/organization_admin.py +95 -0
- qanswer_sdk/models/organization_filter_dto.py +97 -0
- qanswer_sdk/models/organization_list_dto.py +101 -0
- qanswer_sdk/models/organization_llm.py +103 -0
- qanswer_sdk/models/{plan.py → plan_dto.py} +4 -4
- qanswer_sdk/models/prompt_token_count_details.py +3 -3
- qanswer_sdk/models/rag_payload.py +4 -4
- qanswer_sdk/models/rag_response.py +4 -2
- qanswer_sdk/models/relation_extraction_task_settings.py +12 -10
- qanswer_sdk/models/relation_extraction_task_update.py +14 -4
- qanswer_sdk/models/report_copilot_slot_task_settings.py +12 -10
- qanswer_sdk/models/report_copilot_slot_task_update.py +13 -3
- qanswer_sdk/models/report_copilot_task_settings.py +12 -10
- qanswer_sdk/models/report_copilot_task_update.py +14 -4
- qanswer_sdk/models/{report_copilot_template.py → report_template.py} +17 -7
- qanswer_sdk/models/{report_copilot_create_payload.py → report_template_create_payload.py} +4 -4
- qanswer_sdk/models/{report_copilot_template_simplified.py → report_template_simplified.py} +11 -7
- qanswer_sdk/models/{report_copilot_export_template_as_docx_payload_simplified.py → report_template_simplified_payload.py} +4 -4
- qanswer_sdk/models/{report_copilot_update_payload.py → report_template_update_payload.py} +15 -9
- qanswer_sdk/models/search_task_settings.py +12 -12
- qanswer_sdk/models/search_task_update.py +13 -3
- qanswer_sdk/models/{set_logo1_request.py → set_logo2_request.py} +4 -4
- qanswer_sdk/models/shared_organization_access.py +7 -3
- qanswer_sdk/models/shared_team_access.py +10 -4
- qanswer_sdk/models/slot.py +5 -1
- qanswer_sdk/models/slot_update.py +5 -1
- qanswer_sdk/models/socket_conversation_message.py +3 -11
- qanswer_sdk/models/socket_file_metadata.py +17 -11
- qanswer_sdk/models/source_metadata.py +109 -0
- qanswer_sdk/models/{tag_qa_list_payload.py → subscription_response.py} +22 -21
- qanswer_sdk/models/{team_with_count.py → team_admin.py} +8 -8
- qanswer_sdk/models/{team_filter.py → team_filter_dto.py} +16 -6
- qanswer_sdk/models/team_list_dto.py +101 -0
- qanswer_sdk/models/{available_endpoints_response.py → template_clip_structure_input.py} +14 -14
- qanswer_sdk/models/{available_embedding_models_response.py → template_clip_structure_output.py} +14 -14
- qanswer_sdk/models/test_imap_connection_payload.py +95 -0
- qanswer_sdk/models/text2_sparql_payload.py +4 -4
- qanswer_sdk/models/text2_sparql_task_settings.py +12 -10
- qanswer_sdk/models/text2_sparql_task_update.py +14 -4
- qanswer_sdk/models/{user_chatbot_setting_response.py → user_chatbot_setting.py} +24 -24
- qanswer_sdk/models/user_dataset.py +38 -2
- qanswer_sdk/models/{qa_metadata_payload.py → user_dataset_shared.py} +27 -37
- qanswer_sdk/models/{user_filter.py → user_filter_dto.py} +4 -4
- qanswer_sdk/models/{user_profile.py → user_profile_dto.py} +10 -10
- qanswer_sdk/models/user_profile_list_dto.py +3 -3
- qanswer_sdk/models/widget_configs.py +4 -2
- {qanswer_sdk-3.1213.0.dist-info → qanswer_sdk-3.1244.0.dist-info}/METADATA +2 -2
- {qanswer_sdk-3.1213.0.dist-info → qanswer_sdk-3.1244.0.dist-info}/RECORD +135 -112
- qanswer_sdk/api/llm_consumption_controller_api.py +0 -310
- qanswer_sdk/models/organization_filter.py +0 -87
- qanswer_sdk/models/page_organization.py +0 -123
- qanswer_sdk/models/page_team_with_count.py +0 -123
- qanswer_sdk/models/tag_qa_payload.py +0 -91
- {qanswer_sdk-3.1213.0.dist-info → qanswer_sdk-3.1244.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,113 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
QAnswer: Api Documentation
|
5
|
+
|
6
|
+
APIs provided by QAnswer
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from qanswer_sdk.models.aggregations_group import AggregationsGroup
|
23
|
+
from qanswer_sdk.models.imap_file_metadata import ImapFileMetadata
|
24
|
+
from typing import Optional, Set
|
25
|
+
from typing_extensions import Self
|
26
|
+
|
27
|
+
class ImapSearchResponse(BaseModel):
|
28
|
+
"""
|
29
|
+
ImapSearchResponse
|
30
|
+
""" # noqa: E501
|
31
|
+
username: StrictStr
|
32
|
+
dataset: StrictStr
|
33
|
+
connector_id: StrictInt
|
34
|
+
total_count: StrictInt
|
35
|
+
aggregations: Optional[List[AggregationsGroup]] = None
|
36
|
+
files: List[ImapFileMetadata]
|
37
|
+
__properties: ClassVar[List[str]] = ["username", "dataset", "connector_id", "total_count", "aggregations", "files"]
|
38
|
+
|
39
|
+
model_config = ConfigDict(
|
40
|
+
populate_by_name=True,
|
41
|
+
validate_assignment=True,
|
42
|
+
protected_namespaces=(),
|
43
|
+
)
|
44
|
+
|
45
|
+
|
46
|
+
def to_str(self) -> str:
|
47
|
+
"""Returns the string representation of the model using alias"""
|
48
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
49
|
+
|
50
|
+
def to_json(self) -> str:
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
52
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
53
|
+
return json.dumps(self.to_dict())
|
54
|
+
|
55
|
+
@classmethod
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
57
|
+
"""Create an instance of ImapSearchResponse from a JSON string"""
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
59
|
+
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
62
|
+
|
63
|
+
This has the following differences from calling pydantic's
|
64
|
+
`self.model_dump(by_alias=True)`:
|
65
|
+
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
67
|
+
were set at model initialization. Other fields with value `None`
|
68
|
+
are ignored.
|
69
|
+
"""
|
70
|
+
excluded_fields: Set[str] = set([
|
71
|
+
])
|
72
|
+
|
73
|
+
_dict = self.model_dump(
|
74
|
+
by_alias=True,
|
75
|
+
exclude=excluded_fields,
|
76
|
+
exclude_none=True,
|
77
|
+
)
|
78
|
+
# override the default output from pydantic by calling `to_dict()` of each item in aggregations (list)
|
79
|
+
_items = []
|
80
|
+
if self.aggregations:
|
81
|
+
for _item_aggregations in self.aggregations:
|
82
|
+
if _item_aggregations:
|
83
|
+
_items.append(_item_aggregations.to_dict())
|
84
|
+
_dict['aggregations'] = _items
|
85
|
+
# override the default output from pydantic by calling `to_dict()` of each item in files (list)
|
86
|
+
_items = []
|
87
|
+
if self.files:
|
88
|
+
for _item_files in self.files:
|
89
|
+
if _item_files:
|
90
|
+
_items.append(_item_files.to_dict())
|
91
|
+
_dict['files'] = _items
|
92
|
+
return _dict
|
93
|
+
|
94
|
+
@classmethod
|
95
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
96
|
+
"""Create an instance of ImapSearchResponse from a dict"""
|
97
|
+
if obj is None:
|
98
|
+
return None
|
99
|
+
|
100
|
+
if not isinstance(obj, dict):
|
101
|
+
return cls.model_validate(obj)
|
102
|
+
|
103
|
+
_obj = cls.model_validate({
|
104
|
+
"username": obj.get("username"),
|
105
|
+
"dataset": obj.get("dataset"),
|
106
|
+
"connector_id": obj.get("connector_id"),
|
107
|
+
"total_count": obj.get("total_count"),
|
108
|
+
"aggregations": [AggregationsGroup.from_dict(_item) for _item in obj["aggregations"]] if obj.get("aggregations") is not None else None,
|
109
|
+
"files": [ImapFileMetadata.from_dict(_item) for _item in obj["files"]] if obj.get("files") is not None else None
|
110
|
+
})
|
111
|
+
return _obj
|
112
|
+
|
113
|
+
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
QAnswer: Api Documentation
|
5
|
+
|
6
|
+
APIs provided by QAnswer
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
22
|
+
from qanswer_sdk.models.logo import Logo
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
class Llm(BaseModel):
|
27
|
+
"""
|
28
|
+
Llm
|
29
|
+
""" # noqa: E501
|
30
|
+
id: Optional[StrictInt] = None
|
31
|
+
python_id: Optional[StrictInt] = Field(default=None, alias="pythonId")
|
32
|
+
name: Optional[StrictStr] = None
|
33
|
+
display_name: Optional[StrictStr] = Field(default=None, alias="displayName")
|
34
|
+
cost_input_token: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="costInputToken")
|
35
|
+
cost_output_token: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="costOutputToken")
|
36
|
+
sensitivity_level: Optional[StrictStr] = Field(default=None, alias="sensitivityLevel")
|
37
|
+
is_active: Optional[StrictBool] = Field(default=None, alias="isActive")
|
38
|
+
logo: Optional[Logo] = None
|
39
|
+
organization_llms: Optional[List[OrganizationLlm]] = Field(default=None, alias="organizationLlms")
|
40
|
+
user_chatbot_settings: Optional[List[UserChatbotSetting]] = Field(default=None, alias="userChatbotSettings")
|
41
|
+
__properties: ClassVar[List[str]] = ["id", "pythonId", "name", "displayName", "costInputToken", "costOutputToken", "sensitivityLevel", "isActive", "logo", "organizationLlms", "userChatbotSettings"]
|
42
|
+
|
43
|
+
model_config = ConfigDict(
|
44
|
+
populate_by_name=True,
|
45
|
+
validate_assignment=True,
|
46
|
+
protected_namespaces=(),
|
47
|
+
)
|
48
|
+
|
49
|
+
|
50
|
+
def to_str(self) -> str:
|
51
|
+
"""Returns the string representation of the model using alias"""
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
53
|
+
|
54
|
+
def to_json(self) -> str:
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
56
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
57
|
+
return json.dumps(self.to_dict())
|
58
|
+
|
59
|
+
@classmethod
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
61
|
+
"""Create an instance of Llm from a JSON string"""
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
63
|
+
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
66
|
+
|
67
|
+
This has the following differences from calling pydantic's
|
68
|
+
`self.model_dump(by_alias=True)`:
|
69
|
+
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
71
|
+
were set at model initialization. Other fields with value `None`
|
72
|
+
are ignored.
|
73
|
+
"""
|
74
|
+
excluded_fields: Set[str] = set([
|
75
|
+
])
|
76
|
+
|
77
|
+
_dict = self.model_dump(
|
78
|
+
by_alias=True,
|
79
|
+
exclude=excluded_fields,
|
80
|
+
exclude_none=True,
|
81
|
+
)
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of logo
|
83
|
+
if self.logo:
|
84
|
+
_dict['logo'] = self.logo.to_dict()
|
85
|
+
# override the default output from pydantic by calling `to_dict()` of each item in organization_llms (list)
|
86
|
+
_items = []
|
87
|
+
if self.organization_llms:
|
88
|
+
for _item_organization_llms in self.organization_llms:
|
89
|
+
if _item_organization_llms:
|
90
|
+
_items.append(_item_organization_llms.to_dict())
|
91
|
+
_dict['organizationLlms'] = _items
|
92
|
+
# override the default output from pydantic by calling `to_dict()` of each item in user_chatbot_settings (list)
|
93
|
+
_items = []
|
94
|
+
if self.user_chatbot_settings:
|
95
|
+
for _item_user_chatbot_settings in self.user_chatbot_settings:
|
96
|
+
if _item_user_chatbot_settings:
|
97
|
+
_items.append(_item_user_chatbot_settings.to_dict())
|
98
|
+
_dict['userChatbotSettings'] = _items
|
99
|
+
return _dict
|
100
|
+
|
101
|
+
@classmethod
|
102
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
103
|
+
"""Create an instance of Llm from a dict"""
|
104
|
+
if obj is None:
|
105
|
+
return None
|
106
|
+
|
107
|
+
if not isinstance(obj, dict):
|
108
|
+
return cls.model_validate(obj)
|
109
|
+
|
110
|
+
_obj = cls.model_validate({
|
111
|
+
"id": obj.get("id"),
|
112
|
+
"pythonId": obj.get("pythonId"),
|
113
|
+
"name": obj.get("name"),
|
114
|
+
"displayName": obj.get("displayName"),
|
115
|
+
"costInputToken": obj.get("costInputToken"),
|
116
|
+
"costOutputToken": obj.get("costOutputToken"),
|
117
|
+
"sensitivityLevel": obj.get("sensitivityLevel"),
|
118
|
+
"isActive": obj.get("isActive"),
|
119
|
+
"logo": Logo.from_dict(obj["logo"]) if obj.get("logo") is not None else None,
|
120
|
+
"organizationLlms": [OrganizationLlm.from_dict(_item) for _item in obj["organizationLlms"]] if obj.get("organizationLlms") is not None else None,
|
121
|
+
"userChatbotSettings": [UserChatbotSetting.from_dict(_item) for _item in obj["userChatbotSettings"]] if obj.get("userChatbotSettings") is not None else None
|
122
|
+
})
|
123
|
+
return _obj
|
124
|
+
|
125
|
+
from qanswer_sdk.models.organization_llm import OrganizationLlm
|
126
|
+
from qanswer_sdk.models.user_chatbot_setting import UserChatbotSetting
|
127
|
+
# TODO: Rewrite to not use raise_errors
|
128
|
+
Llm.model_rebuild(raise_errors=False)
|
129
|
+
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
QAnswer: Api Documentation
|
5
|
+
|
6
|
+
APIs provided by QAnswer
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from datetime import datetime
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
23
|
+
from qanswer_sdk.models.llm import Llm
|
24
|
+
from qanswer_sdk.models.user import User
|
25
|
+
from typing import Optional, Set
|
26
|
+
from typing_extensions import Self
|
27
|
+
|
28
|
+
class LlmConsumption(BaseModel):
|
29
|
+
"""
|
30
|
+
LlmConsumption
|
31
|
+
""" # noqa: E501
|
32
|
+
id: Optional[StrictInt] = None
|
33
|
+
created: Optional[datetime] = None
|
34
|
+
user: Optional[User] = None
|
35
|
+
dataset: Optional[UserDataset] = None
|
36
|
+
llm: Optional[Llm] = None
|
37
|
+
input_tokens: Optional[StrictInt] = Field(default=None, alias="inputTokens")
|
38
|
+
input_cost: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="inputCost")
|
39
|
+
output_tokens: Optional[StrictInt] = Field(default=None, alias="outputTokens")
|
40
|
+
output_cost: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="outputCost")
|
41
|
+
__properties: ClassVar[List[str]] = ["id", "created", "user", "dataset", "llm", "inputTokens", "inputCost", "outputTokens", "outputCost"]
|
42
|
+
|
43
|
+
model_config = ConfigDict(
|
44
|
+
populate_by_name=True,
|
45
|
+
validate_assignment=True,
|
46
|
+
protected_namespaces=(),
|
47
|
+
)
|
48
|
+
|
49
|
+
|
50
|
+
def to_str(self) -> str:
|
51
|
+
"""Returns the string representation of the model using alias"""
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
53
|
+
|
54
|
+
def to_json(self) -> str:
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
56
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
57
|
+
return json.dumps(self.to_dict())
|
58
|
+
|
59
|
+
@classmethod
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
61
|
+
"""Create an instance of LlmConsumption from a JSON string"""
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
63
|
+
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
66
|
+
|
67
|
+
This has the following differences from calling pydantic's
|
68
|
+
`self.model_dump(by_alias=True)`:
|
69
|
+
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
71
|
+
were set at model initialization. Other fields with value `None`
|
72
|
+
are ignored.
|
73
|
+
"""
|
74
|
+
excluded_fields: Set[str] = set([
|
75
|
+
])
|
76
|
+
|
77
|
+
_dict = self.model_dump(
|
78
|
+
by_alias=True,
|
79
|
+
exclude=excluded_fields,
|
80
|
+
exclude_none=True,
|
81
|
+
)
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of user
|
83
|
+
if self.user:
|
84
|
+
_dict['user'] = self.user.to_dict()
|
85
|
+
# override the default output from pydantic by calling `to_dict()` of dataset
|
86
|
+
if self.dataset:
|
87
|
+
_dict['dataset'] = self.dataset.to_dict()
|
88
|
+
# override the default output from pydantic by calling `to_dict()` of llm
|
89
|
+
if self.llm:
|
90
|
+
_dict['llm'] = self.llm.to_dict()
|
91
|
+
return _dict
|
92
|
+
|
93
|
+
@classmethod
|
94
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
95
|
+
"""Create an instance of LlmConsumption from a dict"""
|
96
|
+
if obj is None:
|
97
|
+
return None
|
98
|
+
|
99
|
+
if not isinstance(obj, dict):
|
100
|
+
return cls.model_validate(obj)
|
101
|
+
|
102
|
+
_obj = cls.model_validate({
|
103
|
+
"id": obj.get("id"),
|
104
|
+
"created": obj.get("created"),
|
105
|
+
"user": User.from_dict(obj["user"]) if obj.get("user") is not None else None,
|
106
|
+
"dataset": UserDataset.from_dict(obj["dataset"]) if obj.get("dataset") is not None else None,
|
107
|
+
"llm": Llm.from_dict(obj["llm"]) if obj.get("llm") is not None else None,
|
108
|
+
"inputTokens": obj.get("inputTokens"),
|
109
|
+
"inputCost": obj.get("inputCost"),
|
110
|
+
"outputTokens": obj.get("outputTokens"),
|
111
|
+
"outputCost": obj.get("outputCost")
|
112
|
+
})
|
113
|
+
return _obj
|
114
|
+
|
115
|
+
from qanswer_sdk.models.user_dataset import UserDataset
|
116
|
+
# TODO: Rewrite to not use raise_errors
|
117
|
+
LlmConsumption.model_rebuild(raise_errors=False)
|
118
|
+
|
@@ -17,20 +17,20 @@ import pprint
|
|
17
17
|
import re # noqa: F401
|
18
18
|
import json
|
19
19
|
|
20
|
-
from pydantic import BaseModel, ConfigDict,
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictInt
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
-
from typing_extensions import Annotated
|
23
22
|
from typing import Optional, Set
|
24
23
|
from typing_extensions import Self
|
25
24
|
|
26
|
-
class
|
25
|
+
class LLMContextRanges(BaseModel):
|
27
26
|
"""
|
28
|
-
|
27
|
+
LLMContextRanges
|
29
28
|
""" # noqa: E501
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
min_context_window: Optional[StrictInt] = None
|
30
|
+
max_context_window: Optional[StrictInt] = None
|
31
|
+
min_max_tokens: Optional[StrictInt] = None
|
32
|
+
max_max_tokens: Optional[StrictInt] = None
|
33
|
+
__properties: ClassVar[List[str]] = ["min_context_window", "max_context_window", "min_max_tokens", "max_max_tokens"]
|
34
34
|
|
35
35
|
model_config = ConfigDict(
|
36
36
|
populate_by_name=True,
|
@@ -50,7 +50,7 @@ class Pageable(BaseModel):
|
|
50
50
|
|
51
51
|
@classmethod
|
52
52
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
53
|
-
"""Create an instance of
|
53
|
+
"""Create an instance of LLMContextRanges from a JSON string"""
|
54
54
|
return cls.from_dict(json.loads(json_str))
|
55
55
|
|
56
56
|
def to_dict(self) -> Dict[str, Any]:
|
@@ -75,7 +75,7 @@ class Pageable(BaseModel):
|
|
75
75
|
|
76
76
|
@classmethod
|
77
77
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
78
|
-
"""Create an instance of
|
78
|
+
"""Create an instance of LLMContextRanges from a dict"""
|
79
79
|
if obj is None:
|
80
80
|
return None
|
81
81
|
|
@@ -83,9 +83,10 @@ class Pageable(BaseModel):
|
|
83
83
|
return cls.model_validate(obj)
|
84
84
|
|
85
85
|
_obj = cls.model_validate({
|
86
|
-
"
|
87
|
-
"
|
88
|
-
"
|
86
|
+
"min_context_window": obj.get("min_context_window"),
|
87
|
+
"max_context_window": obj.get("max_context_window"),
|
88
|
+
"min_max_tokens": obj.get("min_max_tokens"),
|
89
|
+
"max_max_tokens": obj.get("max_max_tokens")
|
89
90
|
})
|
90
91
|
return _obj
|
91
92
|
|
@@ -23,13 +23,15 @@ from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from typing import Optional, Set
|
24
24
|
from typing_extensions import Self
|
25
25
|
|
26
|
-
class
|
26
|
+
class LlmCostFilter(BaseModel):
|
27
27
|
"""
|
28
|
-
|
28
|
+
LlmCostFilter
|
29
29
|
""" # noqa: E501
|
30
30
|
user_id: Optional[StrictInt] = Field(default=None, alias="userId")
|
31
31
|
ai_assistant_id: Optional[StrictInt] = Field(default=None, alias="aiAssistantId")
|
32
|
-
|
32
|
+
organization_id: Optional[StrictInt] = Field(default=None, alias="organizationId")
|
33
|
+
team_id: Optional[StrictInt] = Field(default=None, alias="teamId")
|
34
|
+
llm_id: Optional[StrictInt] = Field(default=None, alias="llmId")
|
33
35
|
start_date: Optional[datetime] = Field(default=None, alias="startDate")
|
34
36
|
end_date: Optional[datetime] = Field(default=None, alias="endDate")
|
35
37
|
group_by: Optional[StrictStr] = Field(default=None, alias="groupBy")
|
@@ -38,7 +40,7 @@ class LlmCost(BaseModel):
|
|
38
40
|
sort_by: Optional[StrictStr] = Field(default=None, alias="sortBy")
|
39
41
|
sort_dir: Optional[StrictStr] = Field(default=None, alias="sortDir")
|
40
42
|
order: Optional[StrictStr] = None
|
41
|
-
__properties: ClassVar[List[str]] = ["userId", "aiAssistantId", "
|
43
|
+
__properties: ClassVar[List[str]] = ["userId", "aiAssistantId", "organizationId", "teamId", "llmId", "startDate", "endDate", "groupBy", "page", "size", "sortBy", "sortDir", "order"]
|
42
44
|
|
43
45
|
model_config = ConfigDict(
|
44
46
|
populate_by_name=True,
|
@@ -58,7 +60,7 @@ class LlmCost(BaseModel):
|
|
58
60
|
|
59
61
|
@classmethod
|
60
62
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
61
|
-
"""Create an instance of
|
63
|
+
"""Create an instance of LlmCostFilter from a JSON string"""
|
62
64
|
return cls.from_dict(json.loads(json_str))
|
63
65
|
|
64
66
|
def to_dict(self) -> Dict[str, Any]:
|
@@ -83,7 +85,7 @@ class LlmCost(BaseModel):
|
|
83
85
|
|
84
86
|
@classmethod
|
85
87
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
86
|
-
"""Create an instance of
|
88
|
+
"""Create an instance of LlmCostFilter from a dict"""
|
87
89
|
if obj is None:
|
88
90
|
return None
|
89
91
|
|
@@ -93,7 +95,9 @@ class LlmCost(BaseModel):
|
|
93
95
|
_obj = cls.model_validate({
|
94
96
|
"userId": obj.get("userId"),
|
95
97
|
"aiAssistantId": obj.get("aiAssistantId"),
|
96
|
-
"
|
98
|
+
"organizationId": obj.get("organizationId"),
|
99
|
+
"teamId": obj.get("teamId"),
|
100
|
+
"llmId": obj.get("llmId"),
|
97
101
|
"startDate": obj.get("startDate"),
|
98
102
|
"endDate": obj.get("endDate"),
|
99
103
|
"groupBy": obj.get("groupBy"),
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
QAnswer: Api Documentation
|
5
|
+
|
6
|
+
APIs provided by QAnswer
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from qanswer_sdk.models.cost_summary_dto import CostSummaryDto
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
class LlmCostList(BaseModel):
|
27
|
+
"""
|
28
|
+
LlmCostList
|
29
|
+
""" # noqa: E501
|
30
|
+
cost_summaries: Optional[List[CostSummaryDto]] = Field(default=None, alias="costSummaries")
|
31
|
+
page: Optional[StrictInt] = None
|
32
|
+
page_size: Optional[StrictInt] = Field(default=None, alias="pageSize")
|
33
|
+
total: Optional[StrictInt] = None
|
34
|
+
__properties: ClassVar[List[str]] = ["costSummaries", "page", "pageSize", "total"]
|
35
|
+
|
36
|
+
model_config = ConfigDict(
|
37
|
+
populate_by_name=True,
|
38
|
+
validate_assignment=True,
|
39
|
+
protected_namespaces=(),
|
40
|
+
)
|
41
|
+
|
42
|
+
|
43
|
+
def to_str(self) -> str:
|
44
|
+
"""Returns the string representation of the model using alias"""
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
46
|
+
|
47
|
+
def to_json(self) -> str:
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
50
|
+
return json.dumps(self.to_dict())
|
51
|
+
|
52
|
+
@classmethod
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
54
|
+
"""Create an instance of LlmCostList from a JSON string"""
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
56
|
+
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
59
|
+
|
60
|
+
This has the following differences from calling pydantic's
|
61
|
+
`self.model_dump(by_alias=True)`:
|
62
|
+
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
64
|
+
were set at model initialization. Other fields with value `None`
|
65
|
+
are ignored.
|
66
|
+
"""
|
67
|
+
excluded_fields: Set[str] = set([
|
68
|
+
])
|
69
|
+
|
70
|
+
_dict = self.model_dump(
|
71
|
+
by_alias=True,
|
72
|
+
exclude=excluded_fields,
|
73
|
+
exclude_none=True,
|
74
|
+
)
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of each item in cost_summaries (list)
|
76
|
+
_items = []
|
77
|
+
if self.cost_summaries:
|
78
|
+
for _item_cost_summaries in self.cost_summaries:
|
79
|
+
if _item_cost_summaries:
|
80
|
+
_items.append(_item_cost_summaries.to_dict())
|
81
|
+
_dict['costSummaries'] = _items
|
82
|
+
return _dict
|
83
|
+
|
84
|
+
@classmethod
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
86
|
+
"""Create an instance of LlmCostList from a dict"""
|
87
|
+
if obj is None:
|
88
|
+
return None
|
89
|
+
|
90
|
+
if not isinstance(obj, dict):
|
91
|
+
return cls.model_validate(obj)
|
92
|
+
|
93
|
+
_obj = cls.model_validate({
|
94
|
+
"costSummaries": [CostSummaryDto.from_dict(_item) for _item in obj["costSummaries"]] if obj.get("costSummaries") is not None else None,
|
95
|
+
"page": obj.get("page"),
|
96
|
+
"pageSize": obj.get("pageSize"),
|
97
|
+
"total": obj.get("total")
|
98
|
+
})
|
99
|
+
return _obj
|
100
|
+
|
101
|
+
|