clarifai 11.6.7__py3-none-any.whl → 11.6.8__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.
clarifai/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "11.6.7"
1
+ __version__ = "11.6.8"
clarifai/cli/base.py CHANGED
@@ -1,4 +1,3 @@
1
- import getpass
2
1
  import json
3
2
  import os
4
3
  import sys
@@ -82,8 +81,20 @@ def login(ctx, api_url, user_id):
82
81
  )
83
82
 
84
83
  # Securely input PAT
85
- pat = getpass.getpass('Enter your Personal Access Token: ')
86
-
84
+ pat = input_or_default(
85
+ 'Enter your Personal Access Token (PAT) value (or type "ENVVAR" to use an environment variable): ',
86
+ 'ENVVAR',
87
+ )
88
+ if pat.lower() == 'envvar':
89
+ pat = os.environ.get('CLARIFAI_PAT')
90
+ if not pat:
91
+ logger.error(
92
+ 'Environment variable "CLARIFAI_PAT" not set. Please set it in your terminal.'
93
+ )
94
+ click.echo(
95
+ 'Aborting login. Please set the environment variable or provide a PAT value and try again.'
96
+ )
97
+ click.abort()
87
98
  # Progress indicator
88
99
  click.echo('\n> Verifying token...')
89
100
  validate_context_auth(pat, user_id, api_url)
@@ -152,9 +163,14 @@ def get_contexts(ctx, output_format):
152
163
  elif output_format == 'name':
153
164
  print('\n'.join(ctx.obj.contexts))
154
165
  elif output_format in ('json', 'yaml'):
155
- dicts = [v.__dict__ for c, v in ctx.obj.contexts.items()]
156
- for d in dicts:
157
- d.pop('pat')
166
+ dicts = []
167
+ for c, v in ctx.obj.contexts.items():
168
+ context_dict = {}
169
+ d = v.to_serializable_dict()
170
+ d.pop('CLARIFAI_PAT', None)
171
+ context_dict['name'] = c
172
+ context_dict['env'] = d
173
+ dicts.append(context_dict)
158
174
  if output_format == 'json':
159
175
  print(json.dumps(dicts))
160
176
  elif output_format == 'yaml':
@@ -216,6 +232,16 @@ def create_context(
216
232
  'personal access token value (default: "ENVVAR" to get our of env var rather than config): ',
217
233
  'ENVVAR',
218
234
  )
235
+ if pat.lower() == 'envvar':
236
+ pat = os.environ.get('CLARIFAI_PAT')
237
+ if not pat:
238
+ logger.error(
239
+ 'Environment variable "CLARIFAI_PAT" not set. Please set it in your terminal.'
240
+ )
241
+ click.echo(
242
+ 'Aborting context creation. Please set the environment variable or provide a PAT value and try again.'
243
+ )
244
+ click.abort()
219
245
  validate_context_auth(pat, user_id, base_url)
220
246
  context = Context(name, CLARIFAI_USER_ID=user_id, CLARIFAI_API_BASE=base_url, CLARIFAI_PAT=pat)
221
247
  ctx.obj.contexts[context.name] = context
clarifai/cli/model.py CHANGED
@@ -728,7 +728,11 @@ def local_runner(ctx, model_path, pool_size, verbose):
728
728
  model_versions = [v for v in model.list_versions()]
729
729
  if len(model_versions) == 0:
730
730
  logger.warning("No model versions found. Creating a new version for local runner.")
731
- version = model.create_version(pretrained_model_config={"local_dev": True}).model_version
731
+ # add the signatures for local runner on how to call it.
732
+ signatures = builder.get_method_signatures(mocking=True)
733
+ version = model.create_version(
734
+ pretrained_model_config={"local_dev": True}, method_signatures=signatures
735
+ ).model_version
732
736
  ctx.obj.current.CLARIFAI_MODEL_VERSION_ID = version.id
733
737
  ctx.obj.to_yaml()
734
738
  else:
@@ -883,30 +887,6 @@ def local_runner(ctx, model_path, pool_size, verbose):
883
887
  logger.error(f"Failed to customize Ollama model: {e}")
884
888
  raise click.Abort()
885
889
 
886
- # don't mock for local runner since you need the dependencies to run the code anyways.
887
- method_signatures = builder.get_method_signatures(mocking=False)
888
-
889
- from clarifai.runners.utils import code_script
890
-
891
- snippet = code_script.generate_client_script(
892
- method_signatures,
893
- user_id=user_id,
894
- app_id=app_id,
895
- model_id=model_id,
896
- deployment_id=deployment_id,
897
- base_url=ctx.obj.current.api_base,
898
- )
899
-
900
- logger.info(f"""\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
901
- # About to start up the local runner in this terminal...
902
- # Here is a code snippet to call this model once it start from another terminal:{snippet}
903
- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
904
- """)
905
-
906
- logger.info(
907
- f"Playground: To chat with your model, visit:\n{ctx.obj.current.ui}/playground?model={model.id}__{version.id}&user_id={user_id}&app_id={app_id}"
908
- )
909
-
910
890
  logger.info("✅ Starting local runner...")
911
891
 
912
892
  # This reads the config.yaml from the model_path so we alter it above first.
@@ -162,7 +162,6 @@ def serve(
162
162
  f"> API URL: To call your model via the API, use this model URL: {context.ui}/users/{context.user_id}/apps/{context.app_id}/models/{context.model_id}\n"
163
163
  )
164
164
  logger.info("Press CTRL+C to stop the runner.\n")
165
-
166
165
  runner.start() # start the runner to fetch work from the API.
167
166
 
168
167
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clarifai
3
- Version: 11.6.7
3
+ Version: 11.6.8
4
4
  Home-page: https://github.com/Clarifai/clarifai-python
5
5
  Author: Clarifai
6
6
  Author-email: support@clarifai.com
@@ -1,14 +1,14 @@
1
- clarifai/__init__.py,sha256=vHcuCYQBbVvJPdk__Lp8UGY_w9oIIXRPc0xgnIK6beI,23
1
+ clarifai/__init__.py,sha256=X6Ae2cXGrameIerv46p54-fULe3UApanwCJ4-JaaI_M,23
2
2
  clarifai/cli.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  clarifai/errors.py,sha256=GXa6D4v_L404J83jnRNFPH7s-1V9lk7w6Ws99f1g-AY,2772
4
4
  clarifai/versions.py,sha256=ecSuEB_nOL2XSoYHDw2n23XUbm_KPOGjudMXmQrGdS8,224
5
5
  clarifai/cli/README.md,sha256=Rm0Sk61u7PrWQBgA6idv0R6ldJGhnVHSlIF2rVzRk8g,3428
6
6
  clarifai/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  clarifai/cli/__main__.py,sha256=7nPbLW7Jr2shkgMPvnxpn4xYGMvIcnqluJ69t9w4H_k,74
8
- clarifai/cli/base.py,sha256=_nXkRu3F8s1SL1LspxUWo5MCbdq7e6gI-iYb3B0-2Oc,9605
8
+ clarifai/cli/base.py,sha256=l1WpCM9URk7mkYmHNpnZYtihbTTmMpBB5oBo9IwgeEo,10677
9
9
  clarifai/cli/compute_cluster.py,sha256=8Xss0Obrp6l1XuxJe0luOqU_pf8vXGDRi6jyIe8qR6k,2282
10
10
  clarifai/cli/deployment.py,sha256=9C4I6_kyMxRkWl6h681wc79-3mAtDHtTUaxRv05OZMs,4262
11
- clarifai/cli/model.py,sha256=r_-loAszX8vOYlW1YI7TgNA4CFPZy4dicqtywoZ39R8,43546
11
+ clarifai/cli/model.py,sha256=UwlHHOfXc-Yd55TfBSOe1YgsqJNrnLPN7gAj8VgEG74,42814
12
12
  clarifai/cli/nodepool.py,sha256=H6OIdUW_EiyDUwZogzEDoYmVwEjLMsgoDlPyE7gjIuU,4245
13
13
  clarifai/cli/pipeline.py,sha256=9ZWVLokXHxqXy0g1_1ACuRX20ckrzyKwnsFfuJZm6Nw,13130
14
14
  clarifai/cli/pipeline_step.py,sha256=dvoC2vAsDcxOCy88VV0X42PG22_7JSu9sfBVsk-Cix4,6133
@@ -72,7 +72,7 @@ clarifai/rag/__init__.py,sha256=wu3PzAzo7uqgrEzuaC9lY_3gj1HFiR3GU3elZIKTT5g,40
72
72
  clarifai/rag/rag.py,sha256=EG3GoFrHFCmA70Tz49_0Jo1-3WIaHSgWGHecPeErcdc,14170
73
73
  clarifai/rag/utils.py,sha256=_gVZdABuMnraCKViLruV75x0F3IpgFXN6amYSGE5_xc,4462
74
74
  clarifai/runners/__init__.py,sha256=wXLaSljH7qLeJCrZdKEnlQh2tNqTQAIZKWOu2rZ6wGs,279
75
- clarifai/runners/server.py,sha256=5xX0Pj_XCKRyEfF4v8DQqvdj94DMWY75sxTetdM9dKg,6253
75
+ clarifai/runners/server.py,sha256=YgF-ZInjQ1DZeZ9UmK77rW35IUIXrJYa3SSm2xoXGtc,6252
76
76
  clarifai/runners/dockerfile_template/Dockerfile.template,sha256=nEnIMqzhAXDbd0Ht7QQm0U7AVPIHWQD6kYnFZ0TKJUM,2428
77
77
  clarifai/runners/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
78
78
  clarifai/runners/models/dummy_openai_model.py,sha256=pcmAVbqTTGG4J3BLVjKfvM_SQ-GET_XexIUdLcr9Zvo,8373
@@ -120,9 +120,9 @@ clarifai/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
120
120
  clarifai/workflows/export.py,sha256=HvUYG9N_-UZoRR0-_tdGbZ950_AeBqawSppgUxQebR0,1913
121
121
  clarifai/workflows/utils.py,sha256=ESL3INcouNcLKCh-nMpfXX-YbtCzX7tz7hT57_RGQ3M,2079
122
122
  clarifai/workflows/validate.py,sha256=UhmukyHkfxiMFrPPeBdUTiCOHQT5-shqivlBYEyKTlU,2931
123
- clarifai-11.6.7.dist-info/licenses/LICENSE,sha256=mUqF_d12-qE2n41g7C5_sq-BMLOcj6CNN-jevr15YHU,555
124
- clarifai-11.6.7.dist-info/METADATA,sha256=uwUjxG1M12d67EI6GLAU9jly-li-CQr0SJcyBNoK0hc,22737
125
- clarifai-11.6.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
126
- clarifai-11.6.7.dist-info/entry_points.txt,sha256=X9FZ4Z-i_r2Ud1RpZ9sNIFYuu_-9fogzCMCRUD9hyX0,51
127
- clarifai-11.6.7.dist-info/top_level.txt,sha256=wUMdCQGjkxaynZ6nZ9FAnvBUCgp5RJUVFSy2j-KYo0s,9
128
- clarifai-11.6.7.dist-info/RECORD,,
123
+ clarifai-11.6.8.dist-info/licenses/LICENSE,sha256=mUqF_d12-qE2n41g7C5_sq-BMLOcj6CNN-jevr15YHU,555
124
+ clarifai-11.6.8.dist-info/METADATA,sha256=KPfsSo5hJ7EUSgWidOaX7PV7-JZNjtp3Qglw_doUc5E,22737
125
+ clarifai-11.6.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
126
+ clarifai-11.6.8.dist-info/entry_points.txt,sha256=X9FZ4Z-i_r2Ud1RpZ9sNIFYuu_-9fogzCMCRUD9hyX0,51
127
+ clarifai-11.6.8.dist-info/top_level.txt,sha256=wUMdCQGjkxaynZ6nZ9FAnvBUCgp5RJUVFSy2j-KYo0s,9
128
+ clarifai-11.6.8.dist-info/RECORD,,