admin-api-lib 3.2.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.
Files changed (106) hide show
  1. admin_api_lib/__init__.py +0 -0
  2. admin_api_lib/api_endpoints/document_deleter.py +24 -0
  3. admin_api_lib/api_endpoints/document_reference_retriever.py +25 -0
  4. admin_api_lib/api_endpoints/documents_status_retriever.py +20 -0
  5. admin_api_lib/api_endpoints/file_uploader.py +31 -0
  6. admin_api_lib/api_endpoints/source_uploader.py +40 -0
  7. admin_api_lib/api_endpoints/uploader_base.py +30 -0
  8. admin_api_lib/apis/__init__.py +0 -0
  9. admin_api_lib/apis/admin_api.py +197 -0
  10. admin_api_lib/apis/admin_api_base.py +120 -0
  11. admin_api_lib/chunker/__init__.py +0 -0
  12. admin_api_lib/chunker/chunker.py +25 -0
  13. admin_api_lib/dependency_container.py +236 -0
  14. admin_api_lib/extractor_api_client/__init__.py +0 -0
  15. admin_api_lib/extractor_api_client/openapi_client/__init__.py +38 -0
  16. admin_api_lib/extractor_api_client/openapi_client/api/__init__.py +4 -0
  17. admin_api_lib/extractor_api_client/openapi_client/api/extractor_api.py +516 -0
  18. admin_api_lib/extractor_api_client/openapi_client/api_client.py +695 -0
  19. admin_api_lib/extractor_api_client/openapi_client/api_response.py +20 -0
  20. admin_api_lib/extractor_api_client/openapi_client/configuration.py +460 -0
  21. admin_api_lib/extractor_api_client/openapi_client/exceptions.py +197 -0
  22. admin_api_lib/extractor_api_client/openapi_client/models/__init__.py +21 -0
  23. admin_api_lib/extractor_api_client/openapi_client/models/content_type.py +34 -0
  24. admin_api_lib/extractor_api_client/openapi_client/models/extraction_parameters.py +103 -0
  25. admin_api_lib/extractor_api_client/openapi_client/models/extraction_request.py +82 -0
  26. admin_api_lib/extractor_api_client/openapi_client/models/information_piece.py +104 -0
  27. admin_api_lib/extractor_api_client/openapi_client/models/key_value_pair.py +92 -0
  28. admin_api_lib/extractor_api_client/openapi_client/rest.py +209 -0
  29. admin_api_lib/extractor_api_client/openapi_client/test/__init__.py +0 -0
  30. admin_api_lib/extractor_api_client/openapi_client/test/test_content_type.py +35 -0
  31. admin_api_lib/extractor_api_client/openapi_client/test/test_extraction_parameters.py +59 -0
  32. admin_api_lib/extractor_api_client/openapi_client/test/test_extraction_request.py +56 -0
  33. admin_api_lib/extractor_api_client/openapi_client/test/test_extractor_api.py +39 -0
  34. admin_api_lib/extractor_api_client/openapi_client/test/test_information_piece.py +62 -0
  35. admin_api_lib/extractor_api_client/openapi_client/test/test_key_value_pair.py +54 -0
  36. admin_api_lib/file_services/file_service.py +77 -0
  37. admin_api_lib/impl/__init__.py +0 -0
  38. admin_api_lib/impl/admin_api.py +167 -0
  39. admin_api_lib/impl/api_endpoints/default_document_deleter.py +84 -0
  40. admin_api_lib/impl/api_endpoints/default_document_reference_retriever.py +72 -0
  41. admin_api_lib/impl/api_endpoints/default_documents_status_retriever.py +41 -0
  42. admin_api_lib/impl/api_endpoints/default_file_uploader.py +234 -0
  43. admin_api_lib/impl/api_endpoints/default_source_uploader.py +202 -0
  44. admin_api_lib/impl/chunker/__init__.py +0 -0
  45. admin_api_lib/impl/chunker/chunker_type.py +11 -0
  46. admin_api_lib/impl/chunker/semantic_text_chunker.py +252 -0
  47. admin_api_lib/impl/chunker/text_chunker.py +33 -0
  48. admin_api_lib/impl/file_services/__init__.py +0 -0
  49. admin_api_lib/impl/file_services/s3_service.py +130 -0
  50. admin_api_lib/impl/information_enhancer/__init__.py +0 -0
  51. admin_api_lib/impl/information_enhancer/general_enhancer.py +52 -0
  52. admin_api_lib/impl/information_enhancer/page_summary_enhancer.py +62 -0
  53. admin_api_lib/impl/information_enhancer/summary_enhancer.py +74 -0
  54. admin_api_lib/impl/key_db/__init__.py +0 -0
  55. admin_api_lib/impl/key_db/file_status_key_value_store.py +111 -0
  56. admin_api_lib/impl/mapper/informationpiece2document.py +108 -0
  57. admin_api_lib/impl/settings/__init__.py +0 -0
  58. admin_api_lib/impl/settings/chunker_class_type_settings.py +18 -0
  59. admin_api_lib/impl/settings/chunker_settings.py +29 -0
  60. admin_api_lib/impl/settings/document_extractor_settings.py +21 -0
  61. admin_api_lib/impl/settings/key_value_settings.py +26 -0
  62. admin_api_lib/impl/settings/rag_api_settings.py +21 -0
  63. admin_api_lib/impl/settings/s3_settings.py +31 -0
  64. admin_api_lib/impl/settings/source_uploader_settings.py +23 -0
  65. admin_api_lib/impl/settings/summarizer_settings.py +86 -0
  66. admin_api_lib/impl/summarizer/__init__.py +0 -0
  67. admin_api_lib/impl/summarizer/langchain_summarizer.py +117 -0
  68. admin_api_lib/information_enhancer/__init__.py +0 -0
  69. admin_api_lib/information_enhancer/information_enhancer.py +34 -0
  70. admin_api_lib/main.py +54 -0
  71. admin_api_lib/models/__init__.py +0 -0
  72. admin_api_lib/models/document_status.py +86 -0
  73. admin_api_lib/models/extra_models.py +9 -0
  74. admin_api_lib/models/http_validation_error.py +105 -0
  75. admin_api_lib/models/key_value_pair.py +85 -0
  76. admin_api_lib/models/status.py +44 -0
  77. admin_api_lib/models/validation_error.py +104 -0
  78. admin_api_lib/models/validation_error_loc_inner.py +114 -0
  79. admin_api_lib/prompt_templates/__init__.py +0 -0
  80. admin_api_lib/prompt_templates/summarize_prompt.py +14 -0
  81. admin_api_lib/rag_backend_client/__init__.py +0 -0
  82. admin_api_lib/rag_backend_client/openapi_client/__init__.py +60 -0
  83. admin_api_lib/rag_backend_client/openapi_client/api/__init__.py +4 -0
  84. admin_api_lib/rag_backend_client/openapi_client/api/rag_api.py +968 -0
  85. admin_api_lib/rag_backend_client/openapi_client/api_client.py +698 -0
  86. admin_api_lib/rag_backend_client/openapi_client/api_response.py +22 -0
  87. admin_api_lib/rag_backend_client/openapi_client/configuration.py +460 -0
  88. admin_api_lib/rag_backend_client/openapi_client/exceptions.py +197 -0
  89. admin_api_lib/rag_backend_client/openapi_client/models/__init__.py +41 -0
  90. admin_api_lib/rag_backend_client/openapi_client/models/chat_history.py +99 -0
  91. admin_api_lib/rag_backend_client/openapi_client/models/chat_history_message.py +83 -0
  92. admin_api_lib/rag_backend_client/openapi_client/models/chat_request.py +93 -0
  93. admin_api_lib/rag_backend_client/openapi_client/models/chat_response.py +103 -0
  94. admin_api_lib/rag_backend_client/openapi_client/models/chat_role.py +35 -0
  95. admin_api_lib/rag_backend_client/openapi_client/models/content_type.py +37 -0
  96. admin_api_lib/rag_backend_client/openapi_client/models/delete_request.py +99 -0
  97. admin_api_lib/rag_backend_client/openapi_client/models/information_piece.py +110 -0
  98. admin_api_lib/rag_backend_client/openapi_client/models/key_value_pair.py +83 -0
  99. admin_api_lib/rag_backend_client/openapi_client/rest.py +209 -0
  100. admin_api_lib/summarizer/__init__.py +0 -0
  101. admin_api_lib/summarizer/summarizer.py +33 -0
  102. admin_api_lib/utils/__init__.py +0 -0
  103. admin_api_lib/utils/utils.py +32 -0
  104. admin_api_lib-3.2.0.dist-info/METADATA +24 -0
  105. admin_api_lib-3.2.0.dist-info/RECORD +106 -0
  106. admin_api_lib-3.2.0.dist-info/WHEEL +4 -0
admin_api_lib/main.py ADDED
@@ -0,0 +1,54 @@
1
+ """Module for the main FastAPI application."""
2
+
3
+ # coding: utf-8
4
+
5
+ import logging.config
6
+
7
+ import yaml
8
+ from dependency_injector.containers import Container
9
+ from fastapi import FastAPI
10
+
11
+ from admin_api_lib.apis.admin_api import router
12
+ from admin_api_lib.dependency_container import DependencyContainer
13
+ from admin_api_lib.impl import admin_api
14
+
15
+ with open("/config/logging.yaml", "r") as stream:
16
+ config = yaml.safe_load(stream)
17
+ logging.config.dictConfig(config)
18
+
19
+ app = FastAPI(
20
+ title="admin-api-lib",
21
+ description="The API is used for the communication between the \
22
+ admin frontend and the admin backend in the rag project.",
23
+ version="1.0.0",
24
+ )
25
+
26
+ app.include_router(router)
27
+
28
+ container = DependencyContainer()
29
+ container.wire(modules=[admin_api])
30
+ app.container = container
31
+
32
+
33
+ def register_dependency_container(new_container: Container):
34
+ """
35
+ Register a new dependency container and rewire the application container.
36
+
37
+ Parameters
38
+ ----------
39
+ new_container : Container
40
+ The new dependency container to be registered.
41
+
42
+ Notes
43
+ -----
44
+ This function preserves the old wiring configuration and then overrides the
45
+ application container with the new container. It rewires the application
46
+ container to include modules from both the old and new wiring configurations.
47
+ """
48
+ # preserve old wiring
49
+ wiring_target = container.wiring_config.modules
50
+ app.container.override(new_container)
51
+
52
+ # rewire
53
+ wiring_target = list(set(wiring_target + new_container.wiring_config.modules))
54
+ app.container.wire(modules=wiring_target)
File without changes
@@ -0,0 +1,86 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ admin-api-lib
5
+
6
+ The API is used for the communication between the admin frontend and the admin backend in the rag project.
7
+
8
+ The version of the OpenAPI document: 1.0.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
+
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from admin_api_lib.models.status import Status
24
+
25
+ try:
26
+ from typing import Self
27
+ except ImportError:
28
+ from typing_extensions import Self
29
+
30
+
31
+ class DocumentStatus(BaseModel):
32
+ """
33
+ DocumentStatus
34
+ """ # noqa: E501
35
+
36
+ name: StrictStr
37
+ status: Status
38
+ __properties: ClassVar[List[str]] = ["name", "status"]
39
+
40
+ model_config = {
41
+ "populate_by_name": True,
42
+ "validate_assignment": True,
43
+ "protected_namespaces": (),
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
+ return self.model_dump_json(by_alias=True, exclude_unset=True)
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Self:
56
+ """Create an instance of DocumentStatus from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ """
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude={},
72
+ exclude_none=True,
73
+ )
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Dict) -> Self:
78
+ """Create an instance of DocumentStatus from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate({"name": obj.get("name"), "status": obj.get("status")})
86
+ return _obj
@@ -0,0 +1,9 @@
1
+ # coding: utf-8
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ class TokenModel(BaseModel):
7
+ """Defines a token model."""
8
+
9
+ sub: str
@@ -0,0 +1,105 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ admin-api-lib
5
+
6
+ The API is used for the communication between the admin frontend and the admin backend in the rag project.
7
+
8
+ The version of the OpenAPI document: 1.0.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
+
21
+ from pydantic import BaseModel, ConfigDict
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from admin_api_lib.models.validation_error import ValidationError
24
+
25
+ try:
26
+ from typing import Self
27
+ except ImportError:
28
+ from typing_extensions import Self
29
+
30
+
31
+ class HTTPValidationError(BaseModel):
32
+ """
33
+ HTTPValidationError
34
+ """ # noqa: E501
35
+
36
+ detail: Optional[List[ValidationError]] = None
37
+ __properties: ClassVar[List[str]] = ["detail"]
38
+
39
+ model_config = {
40
+ "populate_by_name": True,
41
+ "validate_assignment": True,
42
+ "protected_namespaces": (),
43
+ }
44
+
45
+ def to_str(self) -> str:
46
+ """Returns the string representation of the model using alias"""
47
+ return pprint.pformat(self.model_dump(by_alias=True))
48
+
49
+ def to_json(self) -> str:
50
+ """Returns the JSON representation of the model using alias"""
51
+ return self.model_dump_json(by_alias=True, exclude_unset=True)
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Self:
55
+ """Create an instance of HTTPValidationError from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude={},
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of each item in detail (list)
74
+ _items = []
75
+ if self.detail:
76
+ for _item in self.detail:
77
+ if _item:
78
+ _items.append(_item.to_dict())
79
+ _dict["detail"] = _items
80
+ # set to None if detail (nullable) is None
81
+ # and model_fields_set contains the field
82
+ if self.detail is None and "detail" in self.model_fields_set:
83
+ _dict["detail"] = None
84
+
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Dict) -> Self:
89
+ """Create an instance of HTTPValidationError from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate(
97
+ {
98
+ "detail": (
99
+ [ValidationError.from_dict(_item) for _item in obj.get("detail")]
100
+ if obj.get("detail") is not None
101
+ else None
102
+ )
103
+ }
104
+ )
105
+ return _obj
@@ -0,0 +1,85 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ admin-api-lib
5
+
6
+ The API is used for the communication between the admin frontend and the admin backend in the rag project.
7
+
8
+ The version of the OpenAPI document: 1.0.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
+
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+
24
+ try:
25
+ from typing import Self
26
+ except ImportError:
27
+ from typing_extensions import Self
28
+
29
+
30
+ class KeyValuePair(BaseModel):
31
+ """
32
+ KeyValuePair
33
+ """ # noqa: E501
34
+
35
+ key: StrictStr
36
+ value: StrictStr
37
+ __properties: ClassVar[List[str]] = ["key", "value"]
38
+
39
+ model_config = {
40
+ "populate_by_name": True,
41
+ "validate_assignment": True,
42
+ "protected_namespaces": (),
43
+ }
44
+
45
+ def to_str(self) -> str:
46
+ """Returns the string representation of the model using alias"""
47
+ return pprint.pformat(self.model_dump(by_alias=True))
48
+
49
+ def to_json(self) -> str:
50
+ """Returns the JSON representation of the model using alias"""
51
+ return self.model_dump_json(by_alias=True, exclude_unset=True)
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Self:
55
+ """Create an instance of KeyValuePair from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude={},
71
+ exclude_none=True,
72
+ )
73
+ return _dict
74
+
75
+ @classmethod
76
+ def from_dict(cls, obj: Dict) -> Self:
77
+ """Create an instance of KeyValuePair from a dict"""
78
+ if obj is None:
79
+ return None
80
+
81
+ if not isinstance(obj, dict):
82
+ return cls.model_validate(obj)
83
+
84
+ _obj = cls.model_validate({"key": obj.get("key"), "value": obj.get("value")})
85
+ return _obj
@@ -0,0 +1,44 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ admin-api-lib
5
+
6
+ The API is used for the communication between the admin frontend and the admin backend in the rag project.
7
+
8
+ The version of the OpenAPI document: 1.0.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 json
17
+ import pprint
18
+ import re # noqa: F401
19
+ from enum import Enum
20
+
21
+
22
+ try:
23
+ from typing import Self
24
+ except ImportError:
25
+ from typing_extensions import Self
26
+
27
+
28
+ class Status(str, Enum):
29
+ """
30
+ allowed enum values
31
+ """
32
+
33
+ """
34
+ allowed enum values
35
+ """
36
+ UPLOADING = "UPLOADING"
37
+ PROCESSING = "PROCESSING"
38
+ READY = "READY"
39
+ ERROR = "ERROR"
40
+
41
+ @classmethod
42
+ def from_json(cls, json_str: str) -> Self:
43
+ """Create an instance of Status from a JSON string"""
44
+ return cls(json.loads(json_str))
@@ -0,0 +1,104 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ admin-api-lib
5
+
6
+ The API is used for the communication between the admin frontend and the admin backend in the rag project.
7
+
8
+ The version of the OpenAPI document: 1.0.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
+
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from admin_api_lib.models.validation_error_loc_inner import ValidationErrorLocInner
24
+
25
+ try:
26
+ from typing import Self
27
+ except ImportError:
28
+ from typing_extensions import Self
29
+
30
+
31
+ class ValidationError(BaseModel):
32
+ """
33
+ ValidationError
34
+ """ # noqa: E501
35
+
36
+ loc: List[ValidationErrorLocInner]
37
+ msg: StrictStr
38
+ type: StrictStr
39
+ __properties: ClassVar[List[str]] = ["loc", "msg", "type"]
40
+
41
+ model_config = {
42
+ "populate_by_name": True,
43
+ "validate_assignment": True,
44
+ "protected_namespaces": (),
45
+ }
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ return self.model_dump_json(by_alias=True, exclude_unset=True)
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Self:
57
+ """Create an instance of ValidationError 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
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude={},
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of each item in loc (list)
76
+ _items = []
77
+ if self.loc:
78
+ for _item in self.loc:
79
+ if _item:
80
+ _items.append(_item.to_dict())
81
+ _dict["loc"] = _items
82
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Dict) -> Self:
86
+ """Create an instance of ValidationError 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
+ {
95
+ "loc": (
96
+ [ValidationErrorLocInner.from_dict(_item) for _item in obj.get("loc")]
97
+ if obj.get("loc") is not None
98
+ else None
99
+ ),
100
+ "msg": obj.get("msg"),
101
+ "type": obj.get("type"),
102
+ }
103
+ )
104
+ return _obj
@@ -0,0 +1,114 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ admin-api-lib
5
+
6
+ The API is used for the communication between the admin frontend and the admin backend in the rag project.
7
+
8
+ The version of the OpenAPI document: 1.0.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
+
21
+ from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+
24
+ try:
25
+ from typing import Self
26
+ except ImportError:
27
+ from typing_extensions import Self
28
+
29
+
30
+ class ValidationErrorLocInner(BaseModel):
31
+ """
32
+ ValidationErrorLocInner
33
+ """ # noqa: E501
34
+
35
+ anyof_schema_1_validator: Optional[StrictStr] = None
36
+ anyof_schema_2_validator: Optional[StrictInt] = None
37
+ actual_instance: Optional[Any] = None
38
+ any_of_schemas: Optional[List[StrictStr]] = None
39
+ __properties: ClassVar[List[str]] = [
40
+ "anyof_schema_1_validator",
41
+ "anyof_schema_2_validator",
42
+ "actual_instance",
43
+ "any_of_schemas",
44
+ ]
45
+
46
+ model_config = {
47
+ "populate_by_name": True,
48
+ "validate_assignment": True,
49
+ "protected_namespaces": (),
50
+ }
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ return self.model_dump_json(by_alias=True, exclude_unset=True)
59
+
60
+ @classmethod
61
+ def from_json(cls, json_str: str) -> Self:
62
+ """Create an instance of ValidationErrorLocInner from a JSON string"""
63
+ return cls.from_dict(json.loads(json_str))
64
+
65
+ def to_dict(self) -> Dict[str, Any]:
66
+ """Return the dictionary representation of the model using alias.
67
+
68
+ This has the following differences from calling pydantic's
69
+ `self.model_dump(by_alias=True)`:
70
+
71
+ * `None` is only added to the output dict for nullable fields that
72
+ were set at model initialization. Other fields with value `None`
73
+ are ignored.
74
+ """
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude={},
78
+ exclude_none=True,
79
+ )
80
+ # set to None if anyof_schema_1_validator (nullable) is None
81
+ # and model_fields_set contains the field
82
+ if self.anyof_schema_1_validator is None and "anyof_schema_1_validator" in self.model_fields_set:
83
+ _dict["anyof_schema_1_validator"] = None
84
+
85
+ # set to None if anyof_schema_2_validator (nullable) is None
86
+ # and model_fields_set contains the field
87
+ if self.anyof_schema_2_validator is None and "anyof_schema_2_validator" in self.model_fields_set:
88
+ _dict["anyof_schema_2_validator"] = None
89
+
90
+ # set to None if actual_instance (nullable) is None
91
+ # and model_fields_set contains the field
92
+ if self.actual_instance is None and "actual_instance" in self.model_fields_set:
93
+ _dict["actual_instance"] = None
94
+
95
+ return _dict
96
+
97
+ @classmethod
98
+ def from_dict(cls, obj: Dict) -> Self:
99
+ """Create an instance of ValidationErrorLocInner from a dict"""
100
+ if obj is None:
101
+ return None
102
+
103
+ if not isinstance(obj, dict):
104
+ return cls.model_validate(obj)
105
+
106
+ _obj = cls.model_validate(
107
+ {
108
+ "anyof_schema_1_validator": obj.get("anyof_schema_1_validator"),
109
+ "anyof_schema_2_validator": obj.get("anyof_schema_2_validator"),
110
+ "actual_instance": obj.get("actual_instance"),
111
+ "any_of_schemas": obj.get("any_of_schemas"),
112
+ }
113
+ )
114
+ return _obj
File without changes
@@ -0,0 +1,14 @@
1
+ """Module for the summarize prompt template."""
2
+
3
+ from langchain_core.prompts import ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate
4
+
5
+ SUMMARIZE_PROMPT = ChatPromptTemplate.from_messages(
6
+ [
7
+ SystemMessagePromptTemplate.from_template(
8
+ "Fasse den folgenden Text zusammen. Die Ausgabe soll auf Deutsch sein. "
9
+ "Gebe nur die deutsche Zusammenfassung aus, keinen zusätzlichen Text. "
10
+ "Halte dich möglichst kurz mit deiner Antwort."
11
+ ),
12
+ HumanMessagePromptTemplate.from_template("{text}"),
13
+ ]
14
+ )
File without changes
@@ -0,0 +1,60 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+
5
+ """
6
+ STACKIT RAG
7
+
8
+ The perfect rag solution.
9
+
10
+ The version of the OpenAPI document: 1.0.0
11
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
12
+
13
+ Do not edit the class manually.
14
+ """ # noqa: E501
15
+
16
+
17
+ __version__ = "1.0.0"
18
+
19
+ # import apis into sdk package
20
+ from admin_api_lib.rag_backend_client.openapi_client.api.rag_api import RagApi
21
+ from admin_api_lib.rag_backend_client.openapi_client.api_client import ApiClient
22
+
23
+ # import ApiClient
24
+ from admin_api_lib.rag_backend_client.openapi_client.api_response import ApiResponse
25
+ from admin_api_lib.rag_backend_client.openapi_client.configuration import Configuration
26
+ from admin_api_lib.rag_backend_client.openapi_client.exceptions import (
27
+ ApiAttributeError,
28
+ ApiException,
29
+ ApiKeyError,
30
+ ApiTypeError,
31
+ ApiValueError,
32
+ OpenApiException,
33
+ )
34
+
35
+ # import models into sdk package
36
+ from admin_api_lib.rag_backend_client.openapi_client.models.chat_history import (
37
+ ChatHistory,
38
+ )
39
+ from admin_api_lib.rag_backend_client.openapi_client.models.chat_history_message import (
40
+ ChatHistoryMessage,
41
+ )
42
+ from admin_api_lib.rag_backend_client.openapi_client.models.chat_request import (
43
+ ChatRequest,
44
+ )
45
+ from admin_api_lib.rag_backend_client.openapi_client.models.chat_response import (
46
+ ChatResponse,
47
+ )
48
+ from admin_api_lib.rag_backend_client.openapi_client.models.chat_role import ChatRole
49
+ from admin_api_lib.rag_backend_client.openapi_client.models.content_type import (
50
+ ContentType,
51
+ )
52
+ from admin_api_lib.rag_backend_client.openapi_client.models.delete_request import (
53
+ DeleteRequest,
54
+ )
55
+ from admin_api_lib.rag_backend_client.openapi_client.models.information_piece import (
56
+ InformationPiece,
57
+ )
58
+ from admin_api_lib.rag_backend_client.openapi_client.models.key_value_pair import (
59
+ KeyValuePair,
60
+ )
@@ -0,0 +1,4 @@
1
+ # flake8: noqa
2
+
3
+ # import apis into api package
4
+ from admin_api_lib.rag_backend_client.openapi_client.api.rag_api import RagApi