seekrai 0.0.1__tar.gz → 0.1.1__tar.gz

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 (60) hide show
  1. seekrai-0.1.1/PKG-INFO +165 -0
  2. seekrai-0.1.1/README.md +131 -0
  3. {seekrai-0.0.1 → seekrai-0.1.1}/pyproject.toml +4 -5
  4. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/__init__.py +0 -15
  5. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/abstract/api_requestor.py +121 -297
  6. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/client.py +10 -11
  7. seekrai-0.1.1/src/seekrai/constants.py +52 -0
  8. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/error.py +1 -8
  9. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/filemanager.py +40 -79
  10. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/resources/chat/completions.py +13 -13
  11. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/resources/completions.py +4 -4
  12. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/resources/embeddings.py +4 -2
  13. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/resources/files.py +17 -9
  14. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/resources/finetune.py +57 -82
  15. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/resources/images.py +2 -2
  16. seekrai-0.1.1/src/seekrai/resources/models.py +175 -0
  17. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/types/__init__.py +5 -4
  18. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/types/common.py +1 -2
  19. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/types/files.py +23 -19
  20. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/types/finetune.py +20 -26
  21. seekrai-0.1.1/src/seekrai/types/models.py +49 -0
  22. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/utils/_log.py +3 -3
  23. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/utils/api_helpers.py +2 -2
  24. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/utils/tools.py +1 -1
  25. seekrai-0.0.1/PKG-INFO +0 -401
  26. seekrai-0.0.1/README.md +0 -365
  27. seekrai-0.0.1/src/seekrai/cli/__init__.py +0 -0
  28. seekrai-0.0.1/src/seekrai/cli/api/__init__.py +0 -0
  29. seekrai-0.0.1/src/seekrai/cli/api/chat.py +0 -245
  30. seekrai-0.0.1/src/seekrai/cli/api/completions.py +0 -107
  31. seekrai-0.0.1/src/seekrai/cli/api/files.py +0 -125
  32. seekrai-0.0.1/src/seekrai/cli/api/finetune.py +0 -175
  33. seekrai-0.0.1/src/seekrai/cli/api/images.py +0 -82
  34. seekrai-0.0.1/src/seekrai/cli/api/models.py +0 -42
  35. seekrai-0.0.1/src/seekrai/cli/cli.py +0 -77
  36. seekrai-0.0.1/src/seekrai/constants.py +0 -32
  37. seekrai-0.0.1/src/seekrai/legacy/__init__.py +0 -0
  38. seekrai-0.0.1/src/seekrai/legacy/base.py +0 -27
  39. seekrai-0.0.1/src/seekrai/legacy/complete.py +0 -91
  40. seekrai-0.0.1/src/seekrai/legacy/embeddings.py +0 -25
  41. seekrai-0.0.1/src/seekrai/legacy/files.py +0 -140
  42. seekrai-0.0.1/src/seekrai/legacy/finetune.py +0 -173
  43. seekrai-0.0.1/src/seekrai/legacy/images.py +0 -25
  44. seekrai-0.0.1/src/seekrai/legacy/models.py +0 -44
  45. seekrai-0.0.1/src/seekrai/resources/models.py +0 -75
  46. seekrai-0.0.1/src/seekrai/types/models.py +0 -43
  47. {seekrai-0.0.1 → seekrai-0.1.1}/LICENSE +0 -0
  48. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/abstract/__init__.py +0 -0
  49. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/resources/__init__.py +0 -0
  50. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/resources/chat/__init__.py +0 -0
  51. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/seekrflow_response.py +0 -0
  52. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/types/abstract.py +0 -0
  53. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/types/chat_completions.py +0 -0
  54. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/types/completions.py +0 -0
  55. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/types/embeddings.py +0 -0
  56. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/types/error.py +0 -0
  57. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/types/images.py +0 -0
  58. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/utils/__init__.py +0 -0
  59. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/utils/files.py +0 -0
  60. {seekrai-0.0.1 → seekrai-0.1.1}/src/seekrai/version.py +0 -0
seekrai-0.1.1/PKG-INFO ADDED
@@ -0,0 +1,165 @@
1
+ Metadata-Version: 2.1
2
+ Name: seekrai
3
+ Version: 0.1.1
4
+ Summary: Python client for SeekrAI
5
+ Home-page: https://gitlab.cb.ntent.com/ml/seekr-py
6
+ License: Apache-2.0
7
+ Author: SeekrFlow
8
+ Author-email: support@seekr.com
9
+ Requires-Python: >=3.9,<4.0
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Operating System :: POSIX :: Linux
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Requires-Dist: click (>=8.1.7,<9.0.0)
18
+ Requires-Dist: eval-type-backport (>=0.1.3,<0.3.0)
19
+ Requires-Dist: filelock (>=3.13.1,<4.0.0)
20
+ Requires-Dist: httpx (>=0.27.0,<0.28.0)
21
+ Requires-Dist: numpy (>=1.23.5) ; python_version < "3.12"
22
+ Requires-Dist: numpy (>=1.26.0) ; python_version >= "3.12"
23
+ Requires-Dist: pillow (>=10.3.0,<11.0.0)
24
+ Requires-Dist: pyarrow (>=10.0.1)
25
+ Requires-Dist: pydantic (>=2.7,<3.0)
26
+ Requires-Dist: requests (>=2.31.0,<3.0.0)
27
+ Requires-Dist: tabulate (>=0.9.0,<0.10.0)
28
+ Requires-Dist: tqdm (>=4.66.2,<5.0.0)
29
+ Requires-Dist: typer (>=0.9,<0.13)
30
+ Project-URL: Homepage, https://www.seekr.com/
31
+ Project-URL: Repository, https://gitlab.cb.ntent.com/ml/seekr-py
32
+ Description-Content-Type: text/markdown
33
+
34
+ The Seekr Python Library is the official Python client for SeekrFlow's API platform, providing a convenient way for interacting with the REST APIs and enables easy integrations with Python 3.8+ applications with easy to use synchronous and asynchronous clients.
35
+
36
+ # Installation
37
+
38
+ To install Seekr Python Library from PyPi, simply run:
39
+
40
+ ```shell Shell
41
+ pip install --upgrade seekrai
42
+ ```
43
+
44
+ ## Setting up API Key
45
+
46
+ > 🚧 You will need to create an account with [Seekr.com](https://seekr.com/) to obtain a SeekrFlow API Key.
47
+
48
+ ### Setting environment variable
49
+
50
+ ```shell
51
+ export SEEKR_API_KEY=xxxxx
52
+ ```
53
+
54
+ ### Using the client
55
+
56
+ ```python
57
+ from seekrai import SeekrFlow
58
+
59
+ client = SeekrFlow(api_key="xxxxx")
60
+ ```
61
+
62
+ # Usage – Python Client
63
+
64
+ ## Chat Completions
65
+
66
+ ```python
67
+ import os
68
+ from seekrai import SeekrFlow
69
+
70
+ client = SeekrFlow(api_key=os.environ.get("SEEKR_API_KEY"))
71
+
72
+ response = client.chat.completions.create(
73
+ model="meta-llama-3-8b-instruct",
74
+ messages=[{"role": "user", "content": "tell me about new york"}],
75
+ )
76
+ print(response.choices[0].message.content)
77
+ ```
78
+
79
+ ### Streaming
80
+
81
+ ```python
82
+ import os
83
+ from seekrai import SeekrFlow
84
+
85
+ client = SeekrFlow(api_key=os.environ.get("SEEKR_API_KEY"))
86
+ stream = client.chat.completions.create(
87
+ model="meta-llama-3-8b-instruct",
88
+ messages=[{"role": "user", "content": "tell me about new york"}],
89
+ stream=True,
90
+ )
91
+
92
+ for chunk in stream:
93
+ print(chunk.choices[0].delta.content or "", end="", flush=True)
94
+ ```
95
+
96
+ ### Async usage
97
+
98
+ ```python
99
+ import os, asyncio
100
+ from seekrai import AsyncSeekrFlow
101
+
102
+ async_client = AsyncSeekrFlow(api_key=os.environ.get("SEEKR_API_KEY"))
103
+ messages = [
104
+ "What are the top things to do in San Francisco?",
105
+ "What country is Paris in?",
106
+ ]
107
+
108
+
109
+ async def async_chat_completion(messages):
110
+ async_client = AsyncSeekrFlow(api_key=os.environ.get("SEEKR_API_KEY"))
111
+ tasks = [
112
+ async_client.chat.completions.create(
113
+ model="meta-llama-3-8b-instruct",
114
+ messages=[{"role": "user", "content": message}],
115
+ )
116
+ for message in messages
117
+ ]
118
+ responses = await asyncio.gather(*tasks)
119
+
120
+ for response in responses:
121
+ print(response.choices[0].message.content)
122
+
123
+
124
+ asyncio.run(async_chat_completion(messages))
125
+ ```
126
+
127
+ ## Files
128
+
129
+ The files API is used for fine-tuning and allows developers to upload data to fine-tune on. It also has several methods to list all files, retrieve files, and delete files
130
+
131
+ ```python
132
+ import os
133
+ from seekrai import SeekrFlow
134
+
135
+ client = SeekrFlow(api_key=os.environ.get("SEEKR_API_KEY"))
136
+
137
+ client.files.upload(file="somedata.parquet") # uploads a file
138
+ client.files.list() # lists all uploaded files
139
+ client.files.retrieve(id="file-d0d318cb-b7d9-493a-bd70-1cfe089d3815") # retrieves a specific file
140
+ client.files.delete(id="file-d0d318cb-b7d9-493a-bd70-1cfe089d3815") # deletes a file
141
+ ```
142
+
143
+ ## Fine-tunes
144
+
145
+ The finetune API is used for fine-tuning and allows developers to create finetuning jobs. It also has several methods to list all jobs, retrieve statuses and get checkpoints.
146
+
147
+ ```python
148
+ import os
149
+ from seekrai import SeekrFlow
150
+
151
+ client = SeekrFlow(api_key=os.environ.get("SEEKR_API_KEY"))
152
+
153
+ client.fine_tuning.create(
154
+ training_file='file-d0d318cb-b7d9-493a-bd70-1cfe089d3815',
155
+ model='meta-llama-3-8b-instruct',
156
+ n_epochs=3,
157
+ n_checkpoints=1,
158
+ batch_size=4,
159
+ learning_rate=1e-5,
160
+ suffix='my-demo-finetune',
161
+ )
162
+ client.fine_tuning.list() # lists all fine-tuned jobs
163
+ client.fine_tuning.retrieve(id="ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b") # retrieves information on finetune event
164
+ ```
165
+
@@ -0,0 +1,131 @@
1
+ The Seekr Python Library is the official Python client for SeekrFlow's API platform, providing a convenient way for interacting with the REST APIs and enables easy integrations with Python 3.8+ applications with easy to use synchronous and asynchronous clients.
2
+
3
+ # Installation
4
+
5
+ To install Seekr Python Library from PyPi, simply run:
6
+
7
+ ```shell Shell
8
+ pip install --upgrade seekrai
9
+ ```
10
+
11
+ ## Setting up API Key
12
+
13
+ > 🚧 You will need to create an account with [Seekr.com](https://seekr.com/) to obtain a SeekrFlow API Key.
14
+
15
+ ### Setting environment variable
16
+
17
+ ```shell
18
+ export SEEKR_API_KEY=xxxxx
19
+ ```
20
+
21
+ ### Using the client
22
+
23
+ ```python
24
+ from seekrai import SeekrFlow
25
+
26
+ client = SeekrFlow(api_key="xxxxx")
27
+ ```
28
+
29
+ # Usage – Python Client
30
+
31
+ ## Chat Completions
32
+
33
+ ```python
34
+ import os
35
+ from seekrai import SeekrFlow
36
+
37
+ client = SeekrFlow(api_key=os.environ.get("SEEKR_API_KEY"))
38
+
39
+ response = client.chat.completions.create(
40
+ model="meta-llama-3-8b-instruct",
41
+ messages=[{"role": "user", "content": "tell me about new york"}],
42
+ )
43
+ print(response.choices[0].message.content)
44
+ ```
45
+
46
+ ### Streaming
47
+
48
+ ```python
49
+ import os
50
+ from seekrai import SeekrFlow
51
+
52
+ client = SeekrFlow(api_key=os.environ.get("SEEKR_API_KEY"))
53
+ stream = client.chat.completions.create(
54
+ model="meta-llama-3-8b-instruct",
55
+ messages=[{"role": "user", "content": "tell me about new york"}],
56
+ stream=True,
57
+ )
58
+
59
+ for chunk in stream:
60
+ print(chunk.choices[0].delta.content or "", end="", flush=True)
61
+ ```
62
+
63
+ ### Async usage
64
+
65
+ ```python
66
+ import os, asyncio
67
+ from seekrai import AsyncSeekrFlow
68
+
69
+ async_client = AsyncSeekrFlow(api_key=os.environ.get("SEEKR_API_KEY"))
70
+ messages = [
71
+ "What are the top things to do in San Francisco?",
72
+ "What country is Paris in?",
73
+ ]
74
+
75
+
76
+ async def async_chat_completion(messages):
77
+ async_client = AsyncSeekrFlow(api_key=os.environ.get("SEEKR_API_KEY"))
78
+ tasks = [
79
+ async_client.chat.completions.create(
80
+ model="meta-llama-3-8b-instruct",
81
+ messages=[{"role": "user", "content": message}],
82
+ )
83
+ for message in messages
84
+ ]
85
+ responses = await asyncio.gather(*tasks)
86
+
87
+ for response in responses:
88
+ print(response.choices[0].message.content)
89
+
90
+
91
+ asyncio.run(async_chat_completion(messages))
92
+ ```
93
+
94
+ ## Files
95
+
96
+ The files API is used for fine-tuning and allows developers to upload data to fine-tune on. It also has several methods to list all files, retrieve files, and delete files
97
+
98
+ ```python
99
+ import os
100
+ from seekrai import SeekrFlow
101
+
102
+ client = SeekrFlow(api_key=os.environ.get("SEEKR_API_KEY"))
103
+
104
+ client.files.upload(file="somedata.parquet") # uploads a file
105
+ client.files.list() # lists all uploaded files
106
+ client.files.retrieve(id="file-d0d318cb-b7d9-493a-bd70-1cfe089d3815") # retrieves a specific file
107
+ client.files.delete(id="file-d0d318cb-b7d9-493a-bd70-1cfe089d3815") # deletes a file
108
+ ```
109
+
110
+ ## Fine-tunes
111
+
112
+ The finetune API is used for fine-tuning and allows developers to create finetuning jobs. It also has several methods to list all jobs, retrieve statuses and get checkpoints.
113
+
114
+ ```python
115
+ import os
116
+ from seekrai import SeekrFlow
117
+
118
+ client = SeekrFlow(api_key=os.environ.get("SEEKR_API_KEY"))
119
+
120
+ client.fine_tuning.create(
121
+ training_file='file-d0d318cb-b7d9-493a-bd70-1cfe089d3815',
122
+ model='meta-llama-3-8b-instruct',
123
+ n_epochs=3,
124
+ n_checkpoints=1,
125
+ batch_size=4,
126
+ learning_rate=1e-5,
127
+ suffix='my-demo-finetune',
128
+ )
129
+ client.fine_tuning.list() # lists all fine-tuned jobs
130
+ client.fine_tuning.retrieve(id="ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b") # retrieves information on finetune event
131
+ ```
@@ -14,7 +14,7 @@ build-backend = "poetry.core.masonry.api"
14
14
 
15
15
  [tool.poetry]
16
16
  name = "seekrai"
17
- version = "0.0.1"
17
+ version = "0.1.1"
18
18
  authors = [
19
19
  "SeekrFlow <support@seekr.com>"
20
20
  ]
@@ -31,13 +31,12 @@ homepage = "https://gitlab.cb.ntent.com/ml/seekr-py"
31
31
 
32
32
 
33
33
  [tool.poetry.dependencies]
34
- python = "^3.8"
34
+ python = "^3.9"
35
35
  typer = ">=0.9,<0.13"
36
36
  requests = "^2.31.0"
37
37
  tqdm = "^4.66.2"
38
38
  tabulate = "^0.9.0"
39
39
  pydantic = "^2.7"
40
- aiohttp = "^3.9.3"
41
40
  filelock = "^3.13.1"
42
41
  eval-type-backport = ">=0.1.3,<0.3.0"
43
42
  click = "^8.1.7"
@@ -47,7 +46,7 @@ numpy = [
47
46
  { version = ">=1.23.5", python = "<3.12" },
48
47
  { version = ">=1.26.0", python = ">=3.12" },
49
48
  ]
50
- openai = "^1.25.0"
49
+ httpx = "^0.27.0"
51
50
 
52
51
  [tool.poetry.group.quality]
53
52
  optional = true
@@ -57,7 +56,6 @@ black = ">=23.1,<25.0"
57
56
  ruff = ">=0.3.2,<0.5.0"
58
57
  types-tqdm = "^4.65.0.0"
59
58
  types-tabulate = "^0.9.0.3"
60
- pre-commit = "3.5.0"
61
59
  types-requests = "^2.31.0.20240218"
62
60
  pyarrow-stubs = "^10.0.1.7"
63
61
  mypy = "^1.9.0"
@@ -74,6 +72,7 @@ tox = "^4.14.1"
74
72
 
75
73
  [tool.poetry.group.dev.dependencies]
76
74
  ipdb = "^0.13.13"
75
+ pre-commit = "^3.7.1"
77
76
 
78
77
  [tool.poetry.urls]
79
78
  "Homepage" = "https://www.seekr.com/"
@@ -23,30 +23,15 @@ log: str | None = None # Set to either 'debug' or 'info', controls console logg
23
23
 
24
24
  if TYPE_CHECKING:
25
25
  import requests
26
- from aiohttp import ClientSession
27
26
 
28
27
  requestssession: "requests.Session" | Callable[[], "requests.Session"] | None = None
29
28
 
30
- aiosession: ContextVar["ClientSession" | None] = ContextVar(
31
- "aiohttp-session", default=None
32
- )
33
-
34
29
  from seekrai.client import AsyncClient, AsyncSeekrFlow, Client, SeekrFlow
35
30
 
36
31
 
37
32
  api_key: str | None = None # To be deprecated in the next major release
38
33
 
39
- # Legacy functions
40
- from seekrai.legacy.complete import AsyncComplete, Complete, Completion
41
- from seekrai.legacy.embeddings import Embeddings
42
- from seekrai.legacy.files import Files
43
- from seekrai.legacy.finetune import Finetune
44
- from seekrai.legacy.images import Image
45
- from seekrai.legacy.models import Models
46
-
47
-
48
34
  __all__ = [
49
- "aiosession",
50
35
  "constants",
51
36
  "version",
52
37
  "SeekrFlow",