hydra-db-python 0.1.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 (115) hide show
  1. hydra_db/__init__.py +160 -0
  2. hydra_db/client.py +245 -0
  3. hydra_db/core/__init__.py +52 -0
  4. hydra_db/core/api_error.py +23 -0
  5. hydra_db/core/client_wrapper.py +84 -0
  6. hydra_db/core/datetime_utils.py +28 -0
  7. hydra_db/core/file.py +67 -0
  8. hydra_db/core/force_multipart.py +18 -0
  9. hydra_db/core/http_client.py +543 -0
  10. hydra_db/core/http_response.py +55 -0
  11. hydra_db/core/jsonable_encoder.py +100 -0
  12. hydra_db/core/pydantic_utilities.py +258 -0
  13. hydra_db/core/query_encoder.py +58 -0
  14. hydra_db/core/remove_none_from_dict.py +11 -0
  15. hydra_db/core/request_options.py +35 -0
  16. hydra_db/core/serialization.py +276 -0
  17. hydra_db/data/__init__.py +4 -0
  18. hydra_db/data/client.py +123 -0
  19. hydra_db/data/raw_client.py +295 -0
  20. hydra_db/embeddings/__init__.py +4 -0
  21. hydra_db/embeddings/client.py +486 -0
  22. hydra_db/embeddings/raw_client.py +1183 -0
  23. hydra_db/environment.py +7 -0
  24. hydra_db/errors/__init__.py +23 -0
  25. hydra_db/errors/bad_request_error.py +10 -0
  26. hydra_db/errors/forbidden_error.py +10 -0
  27. hydra_db/errors/internal_server_error.py +10 -0
  28. hydra_db/errors/not_found_error.py +10 -0
  29. hydra_db/errors/service_unavailable_error.py +10 -0
  30. hydra_db/errors/too_many_requests_error.py +11 -0
  31. hydra_db/errors/unauthorized_error.py +10 -0
  32. hydra_db/errors/unprocessable_entity_error.py +10 -0
  33. hydra_db/fetch/__init__.py +7 -0
  34. hydra_db/fetch/client.py +408 -0
  35. hydra_db/fetch/raw_client.py +927 -0
  36. hydra_db/fetch/types/__init__.py +7 -0
  37. hydra_db/fetch/types/fetch_list_data_response.py +8 -0
  38. hydra_db/key/__init__.py +4 -0
  39. hydra_db/key/client.py +135 -0
  40. hydra_db/key/raw_client.py +309 -0
  41. hydra_db/raw_client.py +92 -0
  42. hydra_db/recall/__init__.py +4 -0
  43. hydra_db/recall/client.py +699 -0
  44. hydra_db/recall/raw_client.py +1490 -0
  45. hydra_db/tenant/__init__.py +4 -0
  46. hydra_db/tenant/client.py +380 -0
  47. hydra_db/tenant/raw_client.py +1259 -0
  48. hydra_db/types/__init__.py +125 -0
  49. hydra_db/types/actual_error_response.py +20 -0
  50. hydra_db/types/add_memory_response.py +39 -0
  51. hydra_db/types/alpha.py +5 -0
  52. hydra_db/types/api_key_create_response.py +48 -0
  53. hydra_db/types/attachment_model.py +53 -0
  54. hydra_db/types/batch_processing_status.py +23 -0
  55. hydra_db/types/bm_25_operator_type.py +5 -0
  56. hydra_db/types/collection_stats.py +27 -0
  57. hydra_db/types/content_filter.py +49 -0
  58. hydra_db/types/content_model.py +53 -0
  59. hydra_db/types/custom_property_definition.py +75 -0
  60. hydra_db/types/delete_result.py +36 -0
  61. hydra_db/types/delete_user_memory_response.py +31 -0
  62. hydra_db/types/entity.py +42 -0
  63. hydra_db/types/error_response.py +21 -0
  64. hydra_db/types/fetch_mode.py +5 -0
  65. hydra_db/types/forceful_relations_payload.py +27 -0
  66. hydra_db/types/graph_context.py +26 -0
  67. hydra_db/types/infra.py +21 -0
  68. hydra_db/types/infra_status_response.py +42 -0
  69. hydra_db/types/insert_result.py +41 -0
  70. hydra_db/types/list_content_kind.py +5 -0
  71. hydra_db/types/list_user_memories_response.py +43 -0
  72. hydra_db/types/memory_item.py +88 -0
  73. hydra_db/types/memory_result_item.py +47 -0
  74. hydra_db/types/milvus_data_type.py +21 -0
  75. hydra_db/types/pagination_meta.py +51 -0
  76. hydra_db/types/path_triplet.py +23 -0
  77. hydra_db/types/processing_status.py +43 -0
  78. hydra_db/types/processing_status_indexing_status.py +7 -0
  79. hydra_db/types/qn_a_search_response.py +49 -0
  80. hydra_db/types/raw_embedding_document.py +47 -0
  81. hydra_db/types/raw_embedding_search_result.py +47 -0
  82. hydra_db/types/raw_embedding_vector.py +31 -0
  83. hydra_db/types/recall_search_request.py +78 -0
  84. hydra_db/types/relation_evidence.py +72 -0
  85. hydra_db/types/retrieval_result.py +36 -0
  86. hydra_db/types/retrieve_mode.py +5 -0
  87. hydra_db/types/scored_path_response.py +31 -0
  88. hydra_db/types/search_mode.py +5 -0
  89. hydra_db/types/source_delete_response.py +30 -0
  90. hydra_db/types/source_delete_result_item.py +36 -0
  91. hydra_db/types/source_fetch_response.py +70 -0
  92. hydra_db/types/source_graph_relations_response.py +33 -0
  93. hydra_db/types/source_info.py +57 -0
  94. hydra_db/types/source_list_response.py +32 -0
  95. hydra_db/types/source_model.py +99 -0
  96. hydra_db/types/source_status.py +5 -0
  97. hydra_db/types/source_upload_response.py +35 -0
  98. hydra_db/types/source_upload_result_item.py +38 -0
  99. hydra_db/types/sub_tenant_ids_response.py +31 -0
  100. hydra_db/types/supported_llm_providers.py +5 -0
  101. hydra_db/types/tenant_create_accepted_response.py +36 -0
  102. hydra_db/types/tenant_delete_response.py +25 -0
  103. hydra_db/types/tenant_stats_response.py +38 -0
  104. hydra_db/types/triplet_with_evidence.py +35 -0
  105. hydra_db/types/user_assistant_pair.py +31 -0
  106. hydra_db/types/user_memory.py +31 -0
  107. hydra_db/types/vector_store_chunk.py +77 -0
  108. hydra_db/upload/__init__.py +4 -0
  109. hydra_db/upload/client.py +452 -0
  110. hydra_db/upload/raw_client.py +1147 -0
  111. hydra_db_python-0.1.0.dist-info/METADATA +229 -0
  112. hydra_db_python-0.1.0.dist-info/RECORD +115 -0
  113. hydra_db_python-0.1.0.dist-info/WHEEL +5 -0
  114. hydra_db_python-0.1.0.dist-info/licenses/LICENSE +22 -0
  115. hydra_db_python-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import enum
4
+
5
+
6
+ class HydraDBEnvironment(enum.Enum):
7
+ HYDRA_DB_PROD = "https://api.hydradb.com"
@@ -0,0 +1,23 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .bad_request_error import BadRequestError
6
+ from .forbidden_error import ForbiddenError
7
+ from .internal_server_error import InternalServerError
8
+ from .not_found_error import NotFoundError
9
+ from .service_unavailable_error import ServiceUnavailableError
10
+ from .too_many_requests_error import TooManyRequestsError
11
+ from .unauthorized_error import UnauthorizedError
12
+ from .unprocessable_entity_error import UnprocessableEntityError
13
+
14
+ __all__ = [
15
+ "BadRequestError",
16
+ "ForbiddenError",
17
+ "InternalServerError",
18
+ "NotFoundError",
19
+ "ServiceUnavailableError",
20
+ "TooManyRequestsError",
21
+ "UnauthorizedError",
22
+ "UnprocessableEntityError",
23
+ ]
@@ -0,0 +1,10 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+
7
+
8
+ class BadRequestError(ApiError):
9
+ def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ super().__init__(status_code=400, headers=headers, body=body)
@@ -0,0 +1,10 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+
7
+
8
+ class ForbiddenError(ApiError):
9
+ def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ super().__init__(status_code=403, headers=headers, body=body)
@@ -0,0 +1,10 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+
7
+
8
+ class InternalServerError(ApiError):
9
+ def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ super().__init__(status_code=500, headers=headers, body=body)
@@ -0,0 +1,10 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+
7
+
8
+ class NotFoundError(ApiError):
9
+ def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ super().__init__(status_code=404, headers=headers, body=body)
@@ -0,0 +1,10 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+
7
+
8
+ class ServiceUnavailableError(ApiError):
9
+ def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ super().__init__(status_code=503, headers=headers, body=body)
@@ -0,0 +1,11 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+ from ..types.actual_error_response import ActualErrorResponse
7
+
8
+
9
+ class TooManyRequestsError(ApiError):
10
+ def __init__(self, body: ActualErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
11
+ super().__init__(status_code=429, headers=headers, body=body)
@@ -0,0 +1,10 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+
7
+
8
+ class UnauthorizedError(ApiError):
9
+ def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ super().__init__(status_code=401, headers=headers, body=body)
@@ -0,0 +1,10 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.api_error import ApiError
6
+
7
+
8
+ class UnprocessableEntityError(ApiError):
9
+ def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ super().__init__(status_code=422, headers=headers, body=body)
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .types import FetchListDataResponse
6
+
7
+ __all__ = ["FetchListDataResponse"]
@@ -0,0 +1,408 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ..core.request_options import RequestOptions
7
+ from ..types.content_filter import ContentFilter
8
+ from ..types.fetch_mode import FetchMode
9
+ from ..types.list_content_kind import ListContentKind
10
+ from ..types.source_fetch_response import SourceFetchResponse
11
+ from ..types.source_graph_relations_response import SourceGraphRelationsResponse
12
+ from .raw_client import AsyncRawFetchClient, RawFetchClient
13
+ from .types.fetch_list_data_response import FetchListDataResponse
14
+
15
+ # this is used as the default value for optional parameters
16
+ OMIT = typing.cast(typing.Any, ...)
17
+
18
+
19
+ class FetchClient:
20
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
21
+ self._raw_client = RawFetchClient(client_wrapper=client_wrapper)
22
+
23
+ @property
24
+ def with_raw_response(self) -> RawFetchClient:
25
+ """
26
+ Retrieves a raw implementation of this client that returns raw responses.
27
+
28
+ Returns
29
+ -------
30
+ RawFetchClient
31
+ """
32
+ return self._raw_client
33
+
34
+ def list_data(
35
+ self,
36
+ *,
37
+ tenant_id: str,
38
+ sub_tenant_id: typing.Optional[str] = OMIT,
39
+ kind: typing.Optional[ListContentKind] = OMIT,
40
+ source_ids: typing.Optional[typing.Sequence[str]] = OMIT,
41
+ page: typing.Optional[int] = OMIT,
42
+ page_size: typing.Optional[int] = OMIT,
43
+ filters: typing.Optional[ContentFilter] = OMIT,
44
+ include_fields: typing.Optional[typing.Sequence[str]] = OMIT,
45
+ request_options: typing.Optional[RequestOptions] = None,
46
+ ) -> FetchListDataResponse:
47
+ """
48
+ Parameters
49
+ ----------
50
+ tenant_id : str
51
+ Tenant ID
52
+
53
+ sub_tenant_id : typing.Optional[str]
54
+ Sub-tenant ID
55
+
56
+ kind : typing.Optional[ListContentKind]
57
+ Whether to list normal sources or user memories.
58
+
59
+ source_ids : typing.Optional[typing.Sequence[str]]
60
+ Optional list of IDs to fetch (max 100). If omitted, returns all.
61
+
62
+ page : typing.Optional[int]
63
+ Page number to retrieve (1-indexed). Defaults to 1.
64
+
65
+ page_size : typing.Optional[int]
66
+ Number of items per page (1-100). Defaults to 50.
67
+
68
+ filters : typing.Optional[ContentFilter]
69
+ Optional filters. Provide key-value pairs to match against tenant_metadata, document_metadata, and/or source-level fields (title, type, description, url, timestamp).
70
+
71
+ include_fields : typing.Optional[typing.Sequence[str]]
72
+ Optional list of source fields to include in the response. When provided, only the specified fields (plus id, tenant_id, sub_tenant_id which are always returned) will be populated; all other fields will have their default/empty values. This reduces payload size and improves performance. Allowed values: attachments, content, description, document_metadata, note, relations, tenant_metadata, timestamp, title, type, url. Omit or pass null to return all fields. Only applies to kind=knowledge; ignored for kind=memories.
73
+
74
+ request_options : typing.Optional[RequestOptions]
75
+ Request-specific configuration.
76
+
77
+ Returns
78
+ -------
79
+ FetchListDataResponse
80
+ Successful Response
81
+
82
+ Examples
83
+ --------
84
+ from hydra-db import HydraDB
85
+
86
+ client = HydraDB(token="YOUR_TOKEN", )
87
+ client.fetch.list_data(tenant_id='tenant_1234', )
88
+ """
89
+ _response = self._raw_client.list_data(
90
+ tenant_id=tenant_id,
91
+ sub_tenant_id=sub_tenant_id,
92
+ kind=kind,
93
+ source_ids=source_ids,
94
+ page=page,
95
+ page_size=page_size,
96
+ filters=filters,
97
+ include_fields=include_fields,
98
+ request_options=request_options,
99
+ )
100
+ return _response.data
101
+
102
+ def graph_relations_by_source_id(
103
+ self,
104
+ *,
105
+ source_id: str,
106
+ tenant_id: typing.Optional[str] = None,
107
+ is_memory: typing.Optional[bool] = None,
108
+ sub_tenant_id: typing.Optional[str] = None,
109
+ limit: typing.Optional[int] = None,
110
+ request_options: typing.Optional[RequestOptions] = None,
111
+ ) -> SourceGraphRelationsResponse:
112
+ """
113
+ Parameters
114
+ ----------
115
+ source_id : str
116
+ The source ID to fetch relations for
117
+
118
+ tenant_id : typing.Optional[str]
119
+ Unique identifier for the tenant/organization
120
+
121
+ is_memory : typing.Optional[bool]
122
+ Whether to fetch relations for memories
123
+
124
+ sub_tenant_id : typing.Optional[str]
125
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
126
+
127
+ limit : typing.Optional[int]
128
+ Maximum number of relations to return
129
+
130
+ request_options : typing.Optional[RequestOptions]
131
+ Request-specific configuration.
132
+
133
+ Returns
134
+ -------
135
+ SourceGraphRelationsResponse
136
+ Successful Response
137
+
138
+ Examples
139
+ --------
140
+ from hydra-db import HydraDB
141
+
142
+ client = HydraDB(token="YOUR_TOKEN", )
143
+ client.fetch.graph_relations_by_source_id(source_id='<str>', tenant_id='tenant_1234', )
144
+ """
145
+ _response = self._raw_client.graph_relations_by_source_id(
146
+ source_id=source_id,
147
+ tenant_id=tenant_id,
148
+ is_memory=is_memory,
149
+ sub_tenant_id=sub_tenant_id,
150
+ limit=limit,
151
+ request_options=request_options,
152
+ )
153
+ return _response.data
154
+
155
+ def content(
156
+ self,
157
+ *,
158
+ tenant_id: str,
159
+ source_id: str,
160
+ sub_tenant_id: typing.Optional[str] = OMIT,
161
+ mode: typing.Optional[FetchMode] = OMIT,
162
+ expiry_seconds: typing.Optional[int] = OMIT,
163
+ request_options: typing.Optional[RequestOptions] = None,
164
+ ) -> SourceFetchResponse:
165
+ """
166
+ Parameters
167
+ ----------
168
+ tenant_id : str
169
+ Unique identifier for the tenant/organization
170
+
171
+ source_id : str
172
+ Source ID of the file to fetch
173
+
174
+ sub_tenant_id : typing.Optional[str]
175
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
176
+
177
+ mode : typing.Optional[FetchMode]
178
+ Fetch mode: 'content' returns file content, 'url' returns presigned URL, 'both' returns both
179
+
180
+ expiry_seconds : typing.Optional[int]
181
+ Expiry time in seconds for presigned URL (60-604800, default: 3600)
182
+
183
+ request_options : typing.Optional[RequestOptions]
184
+ Request-specific configuration.
185
+
186
+ Returns
187
+ -------
188
+ SourceFetchResponse
189
+ Successful Response
190
+
191
+ Examples
192
+ --------
193
+ from hydra-db import HydraDB
194
+
195
+ client = HydraDB(token="YOUR_TOKEN", )
196
+ client.fetch.content(tenant_id='tenant_1234', source_id='<source_id>', )
197
+ """
198
+ _response = self._raw_client.content(
199
+ tenant_id=tenant_id,
200
+ source_id=source_id,
201
+ sub_tenant_id=sub_tenant_id,
202
+ mode=mode,
203
+ expiry_seconds=expiry_seconds,
204
+ request_options=request_options,
205
+ )
206
+ return _response.data
207
+
208
+
209
+ class AsyncFetchClient:
210
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
211
+ self._raw_client = AsyncRawFetchClient(client_wrapper=client_wrapper)
212
+
213
+ @property
214
+ def with_raw_response(self) -> AsyncRawFetchClient:
215
+ """
216
+ Retrieves a raw implementation of this client that returns raw responses.
217
+
218
+ Returns
219
+ -------
220
+ AsyncRawFetchClient
221
+ """
222
+ return self._raw_client
223
+
224
+ async def list_data(
225
+ self,
226
+ *,
227
+ tenant_id: str,
228
+ sub_tenant_id: typing.Optional[str] = OMIT,
229
+ kind: typing.Optional[ListContentKind] = OMIT,
230
+ source_ids: typing.Optional[typing.Sequence[str]] = OMIT,
231
+ page: typing.Optional[int] = OMIT,
232
+ page_size: typing.Optional[int] = OMIT,
233
+ filters: typing.Optional[ContentFilter] = OMIT,
234
+ include_fields: typing.Optional[typing.Sequence[str]] = OMIT,
235
+ request_options: typing.Optional[RequestOptions] = None,
236
+ ) -> FetchListDataResponse:
237
+ """
238
+ Parameters
239
+ ----------
240
+ tenant_id : str
241
+ Tenant ID
242
+
243
+ sub_tenant_id : typing.Optional[str]
244
+ Sub-tenant ID
245
+
246
+ kind : typing.Optional[ListContentKind]
247
+ Whether to list normal sources or user memories.
248
+
249
+ source_ids : typing.Optional[typing.Sequence[str]]
250
+ Optional list of IDs to fetch (max 100). If omitted, returns all.
251
+
252
+ page : typing.Optional[int]
253
+ Page number to retrieve (1-indexed). Defaults to 1.
254
+
255
+ page_size : typing.Optional[int]
256
+ Number of items per page (1-100). Defaults to 50.
257
+
258
+ filters : typing.Optional[ContentFilter]
259
+ Optional filters. Provide key-value pairs to match against tenant_metadata, document_metadata, and/or source-level fields (title, type, description, url, timestamp).
260
+
261
+ include_fields : typing.Optional[typing.Sequence[str]]
262
+ Optional list of source fields to include in the response. When provided, only the specified fields (plus id, tenant_id, sub_tenant_id which are always returned) will be populated; all other fields will have their default/empty values. This reduces payload size and improves performance. Allowed values: attachments, content, description, document_metadata, note, relations, tenant_metadata, timestamp, title, type, url. Omit or pass null to return all fields. Only applies to kind=knowledge; ignored for kind=memories.
263
+
264
+ request_options : typing.Optional[RequestOptions]
265
+ Request-specific configuration.
266
+
267
+ Returns
268
+ -------
269
+ FetchListDataResponse
270
+ Successful Response
271
+
272
+ Examples
273
+ --------
274
+ import asyncio
275
+
276
+ from hydra-db import AsyncHydraDB
277
+
278
+ client = AsyncHydraDB(token="YOUR_TOKEN", )
279
+ async def main() -> None:
280
+ await client.fetch.list_data(tenant_id='tenant_1234', )
281
+ asyncio.run(main())
282
+ """
283
+ _response = await self._raw_client.list_data(
284
+ tenant_id=tenant_id,
285
+ sub_tenant_id=sub_tenant_id,
286
+ kind=kind,
287
+ source_ids=source_ids,
288
+ page=page,
289
+ page_size=page_size,
290
+ filters=filters,
291
+ include_fields=include_fields,
292
+ request_options=request_options,
293
+ )
294
+ return _response.data
295
+
296
+ async def graph_relations_by_source_id(
297
+ self,
298
+ *,
299
+ source_id: str,
300
+ tenant_id: typing.Optional[str] = None,
301
+ is_memory: typing.Optional[bool] = None,
302
+ sub_tenant_id: typing.Optional[str] = None,
303
+ limit: typing.Optional[int] = None,
304
+ request_options: typing.Optional[RequestOptions] = None,
305
+ ) -> SourceGraphRelationsResponse:
306
+ """
307
+ Parameters
308
+ ----------
309
+ source_id : str
310
+ The source ID to fetch relations for
311
+
312
+ tenant_id : typing.Optional[str]
313
+ Unique identifier for the tenant/organization
314
+
315
+ is_memory : typing.Optional[bool]
316
+ Whether to fetch relations for memories
317
+
318
+ sub_tenant_id : typing.Optional[str]
319
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
320
+
321
+ limit : typing.Optional[int]
322
+ Maximum number of relations to return
323
+
324
+ request_options : typing.Optional[RequestOptions]
325
+ Request-specific configuration.
326
+
327
+ Returns
328
+ -------
329
+ SourceGraphRelationsResponse
330
+ Successful Response
331
+
332
+ Examples
333
+ --------
334
+ import asyncio
335
+
336
+ from hydra-db import AsyncHydraDB
337
+
338
+ client = AsyncHydraDB(token="YOUR_TOKEN", )
339
+ async def main() -> None:
340
+ await client.fetch.graph_relations_by_source_id(source_id='<str>', tenant_id='tenant_1234', )
341
+ asyncio.run(main())
342
+ """
343
+ _response = await self._raw_client.graph_relations_by_source_id(
344
+ source_id=source_id,
345
+ tenant_id=tenant_id,
346
+ is_memory=is_memory,
347
+ sub_tenant_id=sub_tenant_id,
348
+ limit=limit,
349
+ request_options=request_options,
350
+ )
351
+ return _response.data
352
+
353
+ async def content(
354
+ self,
355
+ *,
356
+ tenant_id: str,
357
+ source_id: str,
358
+ sub_tenant_id: typing.Optional[str] = OMIT,
359
+ mode: typing.Optional[FetchMode] = OMIT,
360
+ expiry_seconds: typing.Optional[int] = OMIT,
361
+ request_options: typing.Optional[RequestOptions] = None,
362
+ ) -> SourceFetchResponse:
363
+ """
364
+ Parameters
365
+ ----------
366
+ tenant_id : str
367
+ Unique identifier for the tenant/organization
368
+
369
+ source_id : str
370
+ Source ID of the file to fetch
371
+
372
+ sub_tenant_id : typing.Optional[str]
373
+ Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
374
+
375
+ mode : typing.Optional[FetchMode]
376
+ Fetch mode: 'content' returns file content, 'url' returns presigned URL, 'both' returns both
377
+
378
+ expiry_seconds : typing.Optional[int]
379
+ Expiry time in seconds for presigned URL (60-604800, default: 3600)
380
+
381
+ request_options : typing.Optional[RequestOptions]
382
+ Request-specific configuration.
383
+
384
+ Returns
385
+ -------
386
+ SourceFetchResponse
387
+ Successful Response
388
+
389
+ Examples
390
+ --------
391
+ import asyncio
392
+
393
+ from hydra-db import AsyncHydraDB
394
+
395
+ client = AsyncHydraDB(token="YOUR_TOKEN", )
396
+ async def main() -> None:
397
+ await client.fetch.content(tenant_id='tenant_1234', source_id='<source_id>', )
398
+ asyncio.run(main())
399
+ """
400
+ _response = await self._raw_client.content(
401
+ tenant_id=tenant_id,
402
+ source_id=source_id,
403
+ sub_tenant_id=sub_tenant_id,
404
+ mode=mode,
405
+ expiry_seconds=expiry_seconds,
406
+ request_options=request_options,
407
+ )
408
+ return _response.data