PikoAi 0.1.5__py3-none-any.whl → 0.1.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.
cli.py CHANGED
@@ -296,5 +296,64 @@ def list_models():
296
296
  for model_name_full in model_list: # model_name_full is "openai/gpt-4o", etc.
297
297
  click.echo(f" - {model_name_full}")
298
298
 
299
+ @cli.command('set-api-key')
300
+ @click.option('--provider', '-p', type=click.Choice(list(AVAILABLE_MODELS.keys())),
301
+ help='The LLM provider to set API key for')
302
+ @click.option('--key', '-k', help='The API key to set (if not provided, will prompt for it)')
303
+ def set_api_key(provider, key):
304
+ """Set or update API key for a specific LLM provider"""
305
+ if not provider:
306
+ # If no provider specified, ask user to choose
307
+ questions = [
308
+ inquirer.List('provider_key',
309
+ message="Select LLM Provider to update API key",
310
+ choices=list(AVAILABLE_MODELS.keys())
311
+ )
312
+ ]
313
+ provider = inquirer.prompt(questions)['provider_key']
314
+
315
+ # Get the environment variable name for this provider
316
+ env_var = API_KEYS.get(provider)
317
+ if not env_var:
318
+ raise ValueError(f"Unknown provider: {provider}")
319
+
320
+ # Get the API key (either from command line or prompt)
321
+ if not key:
322
+ questions = [
323
+ inquirer.Text('api_key',
324
+ message=f"Enter your {provider.upper()} API key",
325
+ validate=lambda _, x: len(x.strip()) > 0
326
+ )
327
+ ]
328
+ key = inquirer.prompt(questions)['api_key']
329
+
330
+ # Get the path to .env file
331
+ env_path = os.path.join(os.path.dirname(__file__), '../.env')
332
+
333
+ # Read existing .env file if it exists
334
+ lines = []
335
+ if os.path.exists(env_path):
336
+ with open(env_path, 'r') as f:
337
+ lines = f.readlines()
338
+
339
+ # Update or add the API key
340
+ key_line = f"{env_var}={key}\n"
341
+ key_exists = False
342
+
343
+ for i, line in enumerate(lines):
344
+ if line.strip().startswith(f"{env_var}=") or line.strip().startswith(f"#{env_var}="):
345
+ lines[i] = key_line
346
+ key_exists = True
347
+ break
348
+
349
+ if not key_exists:
350
+ lines.append(key_line)
351
+
352
+ # Write back to .env file
353
+ with open(env_path, 'w') as f:
354
+ f.writelines(lines)
355
+
356
+ click.echo(f"API key for {provider.upper()} has been updated successfully in {env_path}")
357
+
299
358
  if __name__ == '__main__':
300
359
  cli()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PikoAi
3
- Version: 0.1.5
3
+ Version: 0.1.8
4
4
  Summary: An AI-powered task automation tool
5
5
  Home-page: https://github.com/nihaaaar22/OS-Assistant
6
6
  Author: Nihar S
@@ -1,5 +1,5 @@
1
1
  OpenCopilot.py,sha256=6210OONj0yV-LPzkCdZ1RUiHC5NZvLsD-y93Y1zurX0,10687
2
- cli.py,sha256=o2V_DETYXEiYm6617Xg8rDcAgb0ofmojPvdlOpNHwMY,11809
2
+ cli.py,sha256=hY6KUxvKvJOFThZT--r6m2nzOEMIOVtiVptewsi9Z9w,13868
3
3
  Agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  Agents/Executor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  Agents/Executor/executor.py,sha256=zaFO4IQNE1PscvGPV8zoRsQAJAYVTz2JsD_zUBLyYwg,12360
@@ -24,9 +24,9 @@ Utils/executor_utils.py,sha256=eVVxZDcAGxENRV5DhCkgh1AKiJEgfV_1q-iSQNWR5kI,1180
24
24
  Utils/ter_interface.py,sha256=Zay9mwyAyKYTNQAKOWXHAa3upo9TWprSf26STiHXk0g,6255
25
25
  llm_interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  llm_interface/llm.py,sha256=tI_KDOW14QLWowA7bB3GPe2qjlk0sjS5fBavs9XD1fo,5185
27
- pikoai-0.1.5.dist-info/licenses/LICENSE,sha256=cELUVOboOAderKFp8bdtcM5VyJi61YH1oDbRhOuoQZw,1067
28
- pikoai-0.1.5.dist-info/METADATA,sha256=X5Tah8uN8Qse-K9lCNezMn3UPeGNi_-9WUqpg6faSKU,2961
29
- pikoai-0.1.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
- pikoai-0.1.5.dist-info/entry_points.txt,sha256=QVeDO6N3nO3UScMb2ksusQWPgcVn86vXosgL-8gu6fo,33
31
- pikoai-0.1.5.dist-info/top_level.txt,sha256=hWzBNE7UQsuNcENIOksGcJED08k3ZGRRn2X5jnStICU,53
32
- pikoai-0.1.5.dist-info/RECORD,,
27
+ pikoai-0.1.8.dist-info/licenses/LICENSE,sha256=cELUVOboOAderKFp8bdtcM5VyJi61YH1oDbRhOuoQZw,1067
28
+ pikoai-0.1.8.dist-info/METADATA,sha256=BtVoSGxZ_-ZKZ7k1rgSEvkcCsj_5OpHokiHvOOnBkGU,2961
29
+ pikoai-0.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
+ pikoai-0.1.8.dist-info/entry_points.txt,sha256=xjZnheDymNDnQ0o84R0jZKEITrhNbzQWN-AhqfA_d6s,50
31
+ pikoai-0.1.8.dist-info/top_level.txt,sha256=hWzBNE7UQsuNcENIOksGcJED08k3ZGRRn2X5jnStICU,53
32
+ pikoai-0.1.8.dist-info/RECORD,,
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
2
  piko = cli:cli
3
+ pikoai = cli:cli
File without changes