mixpeek 0.8.41__py3-none-any.whl → 0.9.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 (86) hide show
  1. mixpeek-0.9.0.dist-info/METADATA +356 -0
  2. mixpeek-0.9.0.dist-info/RECORD +73 -0
  3. {mixpeek-0.8.41.dist-info → mixpeek-0.9.0.dist-info}/WHEEL +1 -2
  4. mixpeek-0.9.0.dist-info/licenses/LICENSE +201 -0
  5. mixpeek_sdk/__init__.py +93 -0
  6. mixpeek_sdk/_base_client.py +2041 -0
  7. mixpeek_sdk/_client.py +444 -0
  8. mixpeek_sdk/_compat.py +219 -0
  9. mixpeek_sdk/_constants.py +14 -0
  10. mixpeek_sdk/_exceptions.py +108 -0
  11. mixpeek_sdk/_files.py +123 -0
  12. mixpeek_sdk/_models.py +785 -0
  13. mixpeek_sdk/_qs.py +150 -0
  14. mixpeek_sdk/_resource.py +43 -0
  15. mixpeek_sdk/_response.py +826 -0
  16. mixpeek_sdk/_streaming.py +333 -0
  17. mixpeek_sdk/_types.py +217 -0
  18. mixpeek_sdk/_utils/__init__.py +55 -0
  19. mixpeek_sdk/_utils/_logs.py +25 -0
  20. mixpeek_sdk/_utils/_proxy.py +62 -0
  21. mixpeek_sdk/_utils/_reflection.py +42 -0
  22. mixpeek_sdk/_utils/_streams.py +12 -0
  23. mixpeek_sdk/_utils/_sync.py +81 -0
  24. mixpeek_sdk/_utils/_transform.py +382 -0
  25. mixpeek_sdk/_utils/_typing.py +120 -0
  26. mixpeek_sdk/_utils/_utils.py +397 -0
  27. mixpeek_sdk/_version.py +4 -0
  28. mixpeek_sdk/lib/.keep +4 -0
  29. mixpeek_sdk/resources/__init__.py +159 -0
  30. mixpeek_sdk/resources/accounts/__init__.py +33 -0
  31. mixpeek_sdk/resources/accounts/accounts.py +102 -0
  32. mixpeek_sdk/resources/accounts/private.py +232 -0
  33. mixpeek_sdk/resources/agent/__init__.py +33 -0
  34. mixpeek_sdk/resources/agent/agent.py +225 -0
  35. mixpeek_sdk/resources/agent/task.py +189 -0
  36. mixpeek_sdk/resources/collections/__init__.py +33 -0
  37. mixpeek_sdk/resources/collections/collections.py +459 -0
  38. mixpeek_sdk/resources/collections/files.py +679 -0
  39. mixpeek_sdk/resources/describe.py +338 -0
  40. mixpeek_sdk/resources/embed.py +234 -0
  41. mixpeek_sdk/resources/indexes.py +506 -0
  42. mixpeek_sdk/resources/read.py +183 -0
  43. mixpeek_sdk/resources/recognize.py +183 -0
  44. mixpeek_sdk/resources/search.py +542 -0
  45. mixpeek_sdk/resources/tasks.py +294 -0
  46. mixpeek_sdk/resources/transcribe.py +192 -0
  47. mixpeek_sdk/types/__init__.py +19 -0
  48. mixpeek_sdk/types/accounts/__init__.py +6 -0
  49. mixpeek_sdk/types/accounts/private_update_params.py +25 -0
  50. mixpeek_sdk/types/accounts/user.py +32 -0
  51. mixpeek_sdk/types/agent/__init__.py +3 -0
  52. mixpeek_sdk/types/agent_create_params.py +18 -0
  53. mixpeek_sdk/types/agentresponse.py +11 -0
  54. mixpeek_sdk/types/collection_search_params.py +29 -0
  55. mixpeek_sdk/types/collections/__init__.py +9 -0
  56. mixpeek_sdk/types/collections/file_create_params.py +31 -0
  57. mixpeek_sdk/types/collections/file_full_params.py +22 -0
  58. mixpeek_sdk/types/collections/file_update_params.py +18 -0
  59. mixpeek_sdk/types/collections/fileresponse.py +23 -0
  60. mixpeek_sdk/types/collections/groupedfiledata.py +38 -0
  61. mixpeek_sdk/types/describe_upload_params.py +21 -0
  62. mixpeek_sdk/types/describe_url_params.py +20 -0
  63. mixpeek_sdk/types/embed_create_params.py +29 -0
  64. mixpeek_sdk/types/embeddingresponse.py +15 -0
  65. mixpeek_sdk/types/index_face_params.py +23 -0
  66. mixpeek_sdk/types/index_upload_params.py +27 -0
  67. mixpeek_sdk/types/index_url_params.py +159 -0
  68. mixpeek_sdk/types/search_text_params.py +45 -0
  69. mixpeek_sdk/types/search_upload_params.py +25 -0
  70. mixpeek_sdk/types/search_url_params.py +45 -0
  71. mixpeek_sdk/types/taskresponse.py +15 -0
  72. mixpeek_sdk/types/transcribe_url_params.py +18 -0
  73. mixpeek/__init__.py +0 -1
  74. mixpeek/client.py +0 -27
  75. mixpeek/endpoints/collections.py +0 -86
  76. mixpeek/endpoints/embed.py +0 -66
  77. mixpeek/endpoints/index.py +0 -51
  78. mixpeek/endpoints/register.py +0 -34
  79. mixpeek/endpoints/search.py +0 -67
  80. mixpeek/endpoints/tasks.py +0 -26
  81. mixpeek/endpoints/tools.py +0 -138
  82. mixpeek/exceptions.py +0 -13
  83. mixpeek-0.8.41.dist-info/METADATA +0 -375
  84. mixpeek-0.8.41.dist-info/RECORD +0 -15
  85. mixpeek-0.8.41.dist-info/top_level.txt +0 -1
  86. /mixpeek/endpoints/__init__.py → /mixpeek_sdk/py.typed +0 -0
@@ -0,0 +1,22 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Annotated, TypedDict
6
+
7
+ from ..._utils import PropertyInfo
8
+
9
+ __all__ = ["FileFullParams"]
10
+
11
+
12
+ class FileFullParams(TypedDict, total=False):
13
+ modality: str
14
+
15
+ page: int
16
+
17
+ page_size: int
18
+
19
+ authorization: Annotated[str, PropertyInfo(alias="Authorization")]
20
+
21
+ index_id: Annotated[str, PropertyInfo(alias="index-id")]
22
+ """filter by organization"""
@@ -0,0 +1,18 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Required, Annotated, TypedDict
6
+
7
+ from ..._utils import PropertyInfo
8
+
9
+ __all__ = ["FileUpdateParams"]
10
+
11
+
12
+ class FileUpdateParams(TypedDict, total=False):
13
+ body: Required[object]
14
+
15
+ authorization: Annotated[str, PropertyInfo(alias="Authorization")]
16
+
17
+ index_id: Annotated[str, PropertyInfo(alias="index-id")]
18
+ """filter by organization"""
@@ -0,0 +1,23 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from datetime import datetime
4
+
5
+ from ..._models import BaseModel
6
+
7
+ __all__ = ["Fileresponse"]
8
+
9
+
10
+ class Fileresponse(BaseModel):
11
+ collection_id: str
12
+
13
+ created_at: datetime
14
+
15
+ file_id: str
16
+
17
+ index_id: str
18
+
19
+ metadata: object
20
+
21
+ status: str
22
+
23
+ url: str
@@ -0,0 +1,38 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Dict, List, Optional
4
+ from datetime import datetime
5
+
6
+ from ..._models import BaseModel
7
+
8
+ __all__ = ["Groupedfiledata", "ImageDetails"]
9
+
10
+
11
+ class ImageDetails(BaseModel):
12
+ caption: Optional[str] = None
13
+
14
+ description: Optional[str] = None
15
+
16
+ detect: Optional[object] = None
17
+
18
+ text: Optional[str] = None
19
+
20
+
21
+ class Groupedfiledata(BaseModel):
22
+ collection_id: str
23
+
24
+ created_at: datetime
25
+
26
+ file_id: str
27
+
28
+ index_id: str
29
+
30
+ metadata: object
31
+
32
+ status: str
33
+
34
+ url: str
35
+
36
+ image_details: Optional[ImageDetails] = None
37
+
38
+ video_segments: Optional[List[Dict[str, object]]] = None
@@ -0,0 +1,21 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Required, Annotated, TypedDict
6
+
7
+ from .._types import FileTypes
8
+ from .._utils import PropertyInfo
9
+
10
+ __all__ = ["DescribeUploadParams"]
11
+
12
+
13
+ class DescribeUploadParams(TypedDict, total=False):
14
+ file: Required[FileTypes]
15
+
16
+ prompt: Required[str]
17
+
18
+ authorization: Annotated[str, PropertyInfo(alias="Authorization")]
19
+
20
+ index_id: Annotated[str, PropertyInfo(alias="index-id")]
21
+ """filter by organization"""
@@ -0,0 +1,20 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Required, Annotated, TypedDict
6
+
7
+ from .._utils import PropertyInfo
8
+
9
+ __all__ = ["DescribeURLParams"]
10
+
11
+
12
+ class DescribeURLParams(TypedDict, total=False):
13
+ prompt: Required[str]
14
+
15
+ url: Required[str]
16
+
17
+ authorization: Annotated[str, PropertyInfo(alias="Authorization")]
18
+
19
+ index_id: Annotated[str, PropertyInfo(alias="index-id")]
20
+ """filter by organization"""
@@ -0,0 +1,29 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Literal, Required, Annotated, TypedDict
7
+
8
+ from .._utils import PropertyInfo
9
+
10
+ __all__ = ["EmbedCreateParams"]
11
+
12
+
13
+ class EmbedCreateParams(TypedDict, total=False):
14
+ input: Required[str]
15
+ """The input data to be processed."""
16
+
17
+ input_type: Optional[Literal["text", "base64", "url"]]
18
+ """The type of input data. Can be text, base64, or url."""
19
+
20
+ modality: Optional[Literal["video", "image"]]
21
+ """The modality of the input data."""
22
+
23
+ model_id: Optional[object]
24
+ """The model to be used for processing."""
25
+
26
+ authorization: Annotated[str, PropertyInfo(alias="Authorization")]
27
+
28
+ index_id: Annotated[str, PropertyInfo(alias="index-id")]
29
+ """filter by organization"""
@@ -0,0 +1,15 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Optional
4
+
5
+ from .._models import BaseModel
6
+
7
+ __all__ = ["Embeddingresponse"]
8
+
9
+
10
+ class Embeddingresponse(BaseModel):
11
+ embedding: List[float]
12
+ """The embedding of the processed data."""
13
+
14
+ elapsed_time: Optional[float] = None
15
+ """The time taken to process the data."""
@@ -0,0 +1,23 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Required, Annotated, TypedDict
6
+
7
+ from .._types import FileTypes
8
+ from .._utils import PropertyInfo
9
+
10
+ __all__ = ["IndexFaceParams"]
11
+
12
+
13
+ class IndexFaceParams(TypedDict, total=False):
14
+ collection_id: Required[str]
15
+
16
+ file: Required[FileTypes]
17
+
18
+ metadata: str
19
+
20
+ authorization: Annotated[str, PropertyInfo(alias="Authorization")]
21
+
22
+ index_id: Annotated[str, PropertyInfo(alias="index-id")]
23
+ """filter by organization"""
@@ -0,0 +1,27 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Required, Annotated, TypedDict
6
+
7
+ from .._types import FileTypes
8
+ from .._utils import PropertyInfo
9
+
10
+ __all__ = ["IndexUploadParams"]
11
+
12
+
13
+ class IndexUploadParams(TypedDict, total=False):
14
+ collection_id: Required[str]
15
+
16
+ file: Required[FileTypes]
17
+
18
+ image_settings: str
19
+
20
+ metadata: str
21
+
22
+ video_settings: str
23
+
24
+ authorization: Annotated[str, PropertyInfo(alias="Authorization")]
25
+
26
+ index_id: Annotated[str, PropertyInfo(alias="index-id")]
27
+ """filter by organization"""
@@ -0,0 +1,159 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Literal, Required, Annotated, TypedDict
7
+
8
+ from .._utils import PropertyInfo
9
+
10
+ __all__ = [
11
+ "IndexURLParams",
12
+ "ImageSettings",
13
+ "ImageSettingsDescribe",
14
+ "ImageSettingsDetect",
15
+ "ImageSettingsDetectFaces",
16
+ "ImageSettingsEmbed",
17
+ "ImageSettingsJsonOutput",
18
+ "ImageSettingsRead",
19
+ "VideoSettings",
20
+ "VideoSettingsDescribe",
21
+ "VideoSettingsDetect",
22
+ "VideoSettingsDetectFaces",
23
+ "VideoSettingsEmbed",
24
+ "VideoSettingsJsonOutput",
25
+ "VideoSettingsRead",
26
+ "VideoSettingsTranscribe",
27
+ ]
28
+
29
+
30
+ class IndexURLParams(TypedDict, total=False):
31
+ collection_id: Required[str]
32
+
33
+ url: Required[str]
34
+
35
+ image_settings: Optional[ImageSettings]
36
+
37
+ metadata: object
38
+ """Additional metadata associated with the file"""
39
+
40
+ should_save: Optional[bool]
41
+ """Whether to upload the processed file to S3"""
42
+
43
+ video_settings: Optional[VideoSettings]
44
+
45
+ authorization: Annotated[str, PropertyInfo(alias="Authorization")]
46
+
47
+ index_id: Annotated[str, PropertyInfo(alias="index-id")]
48
+ """filter by organization"""
49
+
50
+
51
+ class ImageSettingsDescribe(TypedDict, total=False):
52
+ model_id: Optional[Literal["image-descriptor-v1"]]
53
+
54
+ prompt: Optional[str]
55
+ """Prompt for image description"""
56
+
57
+
58
+ class ImageSettingsDetectFaces(TypedDict, total=False):
59
+ model_id: Optional[Literal["face-detector-v1"]]
60
+ """Model ID for face detection"""
61
+
62
+
63
+ class ImageSettingsDetect(TypedDict, total=False):
64
+ faces: Optional[ImageSettingsDetectFaces]
65
+ """Settings for face detection"""
66
+
67
+
68
+ class ImageSettingsEmbed(TypedDict, total=False):
69
+ model_id: Optional[Literal["image-embed-v1", "multimodal-v1"]]
70
+
71
+
72
+ class ImageSettingsJsonOutput(TypedDict, total=False):
73
+ prompt: Optional[str]
74
+
75
+ response_shape: Optional[object]
76
+
77
+
78
+ class ImageSettingsRead(TypedDict, total=False):
79
+ json_format: object
80
+ """JSON format for the response"""
81
+
82
+ model_id: Optional[Literal["image-descriptor-v1"]]
83
+
84
+ prompt: Optional[str]
85
+ """Prompt for reading on-screen text"""
86
+
87
+
88
+ class ImageSettings(TypedDict, total=False):
89
+ describe: Optional[ImageSettingsDescribe]
90
+
91
+ detect: Optional[ImageSettingsDetect]
92
+
93
+ embed: Optional[ImageSettingsEmbed]
94
+
95
+ json_output: Optional[ImageSettingsJsonOutput]
96
+
97
+ read: Optional[ImageSettingsRead]
98
+
99
+
100
+ class VideoSettingsDescribe(TypedDict, total=False):
101
+ model_id: Optional[Literal["video-descriptor-v1"]]
102
+
103
+ prompt: Optional[str]
104
+ """Prompt for video description"""
105
+
106
+
107
+ class VideoSettingsDetectFaces(TypedDict, total=False):
108
+ model_id: Optional[Literal["face-detector-v1"]]
109
+ """Model ID for face detection"""
110
+
111
+
112
+ class VideoSettingsDetect(TypedDict, total=False):
113
+ faces: Optional[VideoSettingsDetectFaces]
114
+ """Settings for face detection"""
115
+
116
+
117
+ class VideoSettingsEmbed(TypedDict, total=False):
118
+ contextual_text: Optional[str]
119
+
120
+ model_id: Optional[Literal["vuse-generic-v1", "multimodal-v1"]]
121
+
122
+
123
+ class VideoSettingsJsonOutput(TypedDict, total=False):
124
+ prompt: Optional[str]
125
+
126
+ response_shape: Optional[object]
127
+
128
+
129
+ class VideoSettingsRead(TypedDict, total=False):
130
+ json_format: object
131
+ """JSON format for the response"""
132
+
133
+ model_id: Optional[Literal["video-descriptor-v1"]]
134
+
135
+ prompt: Optional[str]
136
+ """Prompt for reading on-screen text"""
137
+
138
+
139
+ class VideoSettingsTranscribe(TypedDict, total=False):
140
+ model_id: Optional[Literal["polyglot-v1"]]
141
+
142
+ prompt: Optional[str]
143
+
144
+
145
+ class VideoSettings(TypedDict, total=False):
146
+ describe: Optional[VideoSettingsDescribe]
147
+
148
+ detect: Optional[VideoSettingsDetect]
149
+
150
+ embed: Optional[VideoSettingsEmbed]
151
+
152
+ interval_sec: int
153
+ """Interval in seconds for processing video"""
154
+
155
+ json_output: Optional[VideoSettingsJsonOutput]
156
+
157
+ read: Optional[VideoSettingsRead]
158
+
159
+ transcribe: Optional[VideoSettingsTranscribe]
@@ -0,0 +1,45 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Required, Annotated, TypedDict
7
+
8
+ from .._utils import PropertyInfo
9
+
10
+ __all__ = ["SearchTextParams", "Pagination"]
11
+
12
+
13
+ class SearchTextParams(TypedDict, total=False):
14
+ input: Required[str]
15
+ """url, text, or base64 input"""
16
+
17
+ filters: object
18
+ """Additional filters for the search"""
19
+
20
+ group_by_file: bool
21
+ """Whether to group search results by file"""
22
+
23
+ input_type: Optional[str]
24
+
25
+ modality: Optional[str]
26
+
27
+ model_id: Optional[str]
28
+
29
+ pagination: Pagination
30
+ """Pagination parameters"""
31
+
32
+ source: Optional[str]
33
+
34
+ authorization: Annotated[str, PropertyInfo(alias="Authorization")]
35
+
36
+ index_id: Annotated[str, PropertyInfo(alias="index-id")]
37
+ """filter by organization"""
38
+
39
+
40
+ class Pagination(TypedDict, total=False):
41
+ page: int
42
+ """Page number"""
43
+
44
+ page_size: int
45
+ """Number of items per page"""
@@ -0,0 +1,25 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Required, Annotated, TypedDict
6
+
7
+ from .._types import FileTypes
8
+ from .._utils import PropertyInfo
9
+
10
+ __all__ = ["SearchUploadParams"]
11
+
12
+
13
+ class SearchUploadParams(TypedDict, total=False):
14
+ file: Required[FileTypes]
15
+
16
+ filters: str
17
+
18
+ page: int
19
+
20
+ page_size: int
21
+
22
+ authorization: Annotated[str, PropertyInfo(alias="Authorization")]
23
+
24
+ index_id: Annotated[str, PropertyInfo(alias="index-id")]
25
+ """filter by organization"""
@@ -0,0 +1,45 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Required, Annotated, TypedDict
7
+
8
+ from .._utils import PropertyInfo
9
+
10
+ __all__ = ["SearchURLParams", "Pagination"]
11
+
12
+
13
+ class SearchURLParams(TypedDict, total=False):
14
+ input: Required[str]
15
+ """url, text, or base64 input"""
16
+
17
+ filters: object
18
+ """Additional filters for the search"""
19
+
20
+ group_by_file: bool
21
+ """Whether to group search results by file"""
22
+
23
+ input_type: Optional[str]
24
+
25
+ modality: Optional[str]
26
+
27
+ model_id: Optional[str]
28
+
29
+ pagination: Pagination
30
+ """Pagination parameters"""
31
+
32
+ source: Optional[str]
33
+
34
+ authorization: Annotated[str, PropertyInfo(alias="Authorization")]
35
+
36
+ index_id: Annotated[str, PropertyInfo(alias="index-id")]
37
+ """filter by organization"""
38
+
39
+
40
+ class Pagination(TypedDict, total=False):
41
+ page: int
42
+ """Page number"""
43
+
44
+ page_size: int
45
+ """Number of items per page"""
@@ -0,0 +1,15 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing_extensions import Literal
4
+
5
+ from .._models import BaseModel
6
+
7
+ __all__ = ["Taskresponse"]
8
+
9
+
10
+ class Taskresponse(BaseModel):
11
+ file_id: str
12
+
13
+ status: Literal["DONE", "FAILED", "PROCESSING", "DOWNLOADING", "INITIALIZING"]
14
+
15
+ task_id: str
@@ -0,0 +1,18 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Required, Annotated, TypedDict
6
+
7
+ from .._utils import PropertyInfo
8
+
9
+ __all__ = ["TranscribeURLParams"]
10
+
11
+
12
+ class TranscribeURLParams(TypedDict, total=False):
13
+ url: Required[str]
14
+
15
+ authorization: Annotated[str, PropertyInfo(alias="Authorization")]
16
+
17
+ index_id: Annotated[str, PropertyInfo(alias="index-id")]
18
+ """filter by organization"""
mixpeek/__init__.py DELETED
@@ -1 +0,0 @@
1
- from .client import Mixpeek
mixpeek/client.py DELETED
@@ -1,27 +0,0 @@
1
- import requests
2
-
3
- from .endpoints.embed import Embed
4
- from .endpoints.collections import Collections
5
- from .endpoints.index import Index
6
- from .endpoints.search import Search
7
- from .endpoints.tools import Tools
8
- from .endpoints.register import Register
9
-
10
-
11
- class Mixpeek:
12
- def __init__(self, api_key: str):
13
- self.api_key = api_key
14
- self.base_url = "https://api.mixpeek.com/"
15
- self.headers = {
16
- "Authorization": f"Bearer {self.api_key}",
17
- "Content-Type": "application/json"
18
- }
19
- # these are remote
20
- self.embed = Embed(self.base_url, self.headers)
21
- self.collections = Collections(self.base_url, self.headers)
22
- self.index = Index(self.base_url, self.headers)
23
- self.search = Search(self.base_url, self.headers)
24
- self.register = Register(self.base_url, self.headers)
25
-
26
- # tools is all local
27
- self.tools = Tools()
@@ -1,86 +0,0 @@
1
- import requests
2
-
3
- class Collections:
4
- def __init__(self, base_url, headers):
5
- self.base_url = base_url
6
- self.headers = headers
7
-
8
- def list_files(self, collection_id, randomize=False, page=1, page_size=10, filters=None, sort_by=None, sort_order="asc"):
9
- try:
10
- url = f"{self.base_url}collections/"
11
- data = {
12
- "collection_id": collection_id,
13
- "randomize": randomize,
14
- "page": page,
15
- "page_size": page_size,
16
- "filters": filters,
17
- "sort_by": sort_by,
18
- "sort_order": sort_order
19
- }
20
- response = requests.post(url, json=data, headers=self.headers)
21
- response.raise_for_status()
22
- return response.json()
23
- except requests.RequestException as e:
24
- return {"error": str(e)}
25
-
26
- def list_collections(self):
27
- try:
28
- url = f"{self.base_url}collections/"
29
- response = requests.get(url, headers=self.headers)
30
- response.raise_for_status()
31
- return response.json()
32
- except requests.RequestException as e:
33
- return {"error": str(e)}
34
-
35
- def search_files(self, query, collection_id, page=1, page_size=10, sort_by=None, sort_order="asc"):
36
- try:
37
- url = f"{self.base_url}collections/search"
38
- data = {
39
- "query": query,
40
- "collection_id": collection_id,
41
- "page": page,
42
- "page_size": page_size,
43
- "sort_by": sort_by,
44
- "sort_order": sort_order
45
- }
46
- response = requests.post(url, json=data, headers=self.headers)
47
- response.raise_for_status()
48
- return response.json()
49
- except requests.RequestException as e:
50
- return {"error": str(e)}
51
-
52
- def get_file_by_id(self, file_id):
53
- try:
54
- url = f"{self.base_url}collections/file/{file_id}"
55
- response = requests.get(url, headers=self.headers)
56
- response.raise_for_status()
57
- return response.json()
58
- except requests.RequestException as e:
59
- return {"error": str(e)}
60
-
61
- def get_full_file(self, file_id):
62
- try:
63
- url = f"{self.base_url}collections/file/{file_id}/full"
64
- response = requests.get(url, headers=self.headers)
65
- response.raise_for_status()
66
- return response.json()
67
- except requests.RequestException as e:
68
- return {"error": str(e)}
69
-
70
- def delete_file_by_id(self, file_id):
71
- try:
72
- url = f"{self.base_url}collections/file/{file_id}"
73
- response = requests.delete(url, headers=self.headers)
74
- response.raise_for_status()
75
- return response.json()
76
- except requests.RequestException as e:
77
- return {"error": str(e)}
78
-
79
- def delete_collection(self, collection_id):
80
- try:
81
- url = f"{self.base_url}collections/{collection_id}"
82
- response = requests.delete(url, headers=self.headers)
83
- response.raise_for_status()
84
- return response.json()
85
- except requests.RequestException as e:
86
- return {"error": str(e)}