pygeai 0.4.0b3__py3-none-any.whl → 0.5.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 (61) hide show
  1. pygeai/__init__.py +1 -1
  2. pygeai/assistant/rag/models.py +1 -1
  3. pygeai/chat/ui.py +0 -1
  4. pygeai/cli/__init__.py +1 -1
  5. pygeai/cli/commands/chat.py +54 -56
  6. pygeai/cli/commands/lab/ai_lab.py +129 -466
  7. pygeai/cli/commands/lab/options.py +8 -0
  8. pygeai/cli/commands/lab/utils.py +13 -0
  9. pygeai/cli/geai.py +5 -2
  10. pygeai/cli/texts/help.py +12 -0
  11. pygeai/core/base/session.py +1 -1
  12. pygeai/core/common/config.py +0 -2
  13. pygeai/core/common/exceptions.py +6 -0
  14. pygeai/lab/agents/clients.py +30 -61
  15. pygeai/lab/clients.py +20 -0
  16. pygeai/lab/managers.py +6 -58
  17. pygeai/lab/models.py +1 -1
  18. pygeai/lab/processes/clients.py +81 -129
  19. pygeai/lab/processes/mappers.py +2 -2
  20. pygeai/lab/strategies/clients.py +11 -17
  21. pygeai/lab/tools/clients.py +59 -59
  22. pygeai/lab/tools/mappers.py +5 -5
  23. pygeai/tests/cli/docker/__init__.py +0 -0
  24. pygeai/tests/integration/assistants/__init__.py +0 -0
  25. pygeai/tests/integration/assistants/rag/__init__.py +0 -0
  26. pygeai/tests/integration/assistants/rag/test_create_rag.py +91 -0
  27. pygeai/tests/integration/chat/__init__.py +0 -0
  28. pygeai/tests/integration/chat/test_generate_image.py +158 -0
  29. pygeai/tests/integration/lab/agents/test_create_agent.py +21 -19
  30. pygeai/tests/integration/lab/agents/test_create_sharing_link.py +4 -1
  31. pygeai/tests/integration/lab/agents/test_publish_agent_revision.py +0 -1
  32. pygeai/tests/integration/lab/agents/test_update_agent.py +19 -31
  33. pygeai/tests/integration/lab/processes/__init__.py +0 -0
  34. pygeai/tests/integration/lab/processes/test_create_process.py +345 -0
  35. pygeai/tests/integration/lab/processes/test_get_process.py +201 -0
  36. pygeai/tests/integration/lab/processes/test_update_process.py +289 -0
  37. pygeai/tests/integration/lab/reasoning_strategies/__init__.py +0 -0
  38. pygeai/tests/integration/lab/reasoning_strategies/test_get_reasoning_strategy.py +70 -0
  39. pygeai/tests/integration/lab/reasoning_strategies/test_list_reasoning_strategies.py +93 -0
  40. pygeai/tests/integration/lab/reasoning_strategies/test_update_reasoning_strategy.py +149 -0
  41. pygeai/tests/integration/lab/tools/test_create_tool.py +14 -20
  42. pygeai/tests/integration/lab/tools/test_delete_tool.py +3 -3
  43. pygeai/tests/integration/lab/tools/test_get_parameter.py +98 -0
  44. pygeai/tests/integration/lab/tools/test_get_tool.py +3 -3
  45. pygeai/tests/integration/lab/tools/test_list_tools.py +106 -0
  46. pygeai/tests/integration/lab/tools/test_publish_tool_revision.py +119 -0
  47. pygeai/tests/integration/lab/tools/test_set_parameter.py +114 -0
  48. pygeai/tests/integration/lab/tools/test_update_tool.py +267 -0
  49. pygeai/tests/snippets/lab/agentic_flow_example_4.py +23 -23
  50. pygeai/tests/snippets/lab/agents/get_sharing_link.py +1 -2
  51. pygeai/tests/snippets/lab/samples/summarize_files.py +3 -3
  52. pygeai/tests/snippets/lab/tools/create_tool.py +1 -1
  53. pygeai/tests/snippets/lab/use_cases/file_summarizer_example.py +3 -3
  54. pygeai/tests/snippets/lab/use_cases/file_summarizer_example_2.py +11 -11
  55. pygeai/tests/snippets/lab/use_cases/update_web_reader.py +1 -2
  56. {pygeai-0.4.0b3.dist-info → pygeai-0.5.0.dist-info}/METADATA +47 -19
  57. {pygeai-0.4.0b3.dist-info → pygeai-0.5.0.dist-info}/RECORD +61 -39
  58. {pygeai-0.4.0b3.dist-info → pygeai-0.5.0.dist-info}/WHEEL +0 -0
  59. {pygeai-0.4.0b3.dist-info → pygeai-0.5.0.dist-info}/entry_points.txt +0 -0
  60. {pygeai-0.4.0b3.dist-info → pygeai-0.5.0.dist-info}/licenses/LICENSE +0 -0
  61. {pygeai-0.4.0b3.dist-info → pygeai-0.5.0.dist-info}/top_level.txt +0 -0
pygeai/__init__.py CHANGED
@@ -4,7 +4,7 @@ import sys
4
4
  from pathlib import Path
5
5
 
6
6
  __author__ = 'Globant'
7
- __version__ = '0.4.0'
7
+ __version__ = '0.5.0'
8
8
 
9
9
  # Add vendor directory to Python path
10
10
  package_root = Path(__file__).parent
@@ -227,7 +227,7 @@ class SearchOptions(CustomBaseModel):
227
227
  "ingestion": self.ingestion.to_dict() if self.ingestion else None,
228
228
  "options": self.options,
229
229
  "rerank": self.rerank,
230
- "variables": self.variables.to_dict() if self.variables else None,
230
+ "variables": self.variables.to_list() if self.variables else None,
231
231
  "vectorStore": self.vector_store
232
232
  }
233
233
  return {k: v for k, v in result.items() if v is not None}
pygeai/chat/ui.py CHANGED
@@ -1,5 +1,4 @@
1
1
  import logging
2
- from pathlib import Path
3
2
 
4
3
  import streamlit as st
5
4
  import argparse
pygeai/cli/__init__.py CHANGED
@@ -4,5 +4,5 @@ GEAI - ClI
4
4
  Command line interface to interact with Globant Enterprise AI.
5
5
  """
6
6
 
7
- __version__ = '0.4.0'
7
+ __version__ = '0.5.0'
8
8
 
@@ -13,12 +13,14 @@ from pygeai.chat.session import AgentChatSession
13
13
  from pygeai.cli.commands import Command, Option, ArgumentsEnum
14
14
  from pygeai.cli.commands.builders import build_help_text
15
15
  from pygeai.cli.commands.common import get_messages, get_boolean_value, get_penalty_float_value
16
+ from pygeai.cli.commands.lab.utils import get_project_id
16
17
  from pygeai.cli.texts.help import CHAT_HELP_TEXT
17
- from pygeai.core.common.exceptions import MissingRequirementException, WrongArgumentError
18
+ from pygeai.core.common.exceptions import MissingRequirementException, WrongArgumentError, InvalidAgentException
18
19
  from prompt_toolkit import PromptSession
19
20
  from prompt_toolkit.history import InMemoryHistory
20
21
 
21
22
  from pygeai.core.utils.console import Console
23
+ from pygeai.lab.agents.clients import AgentClient
22
24
 
23
25
 
24
26
  def show_help():
@@ -359,71 +361,67 @@ def chat_with_agent(option_list: list):
359
361
  if not agent_name:
360
362
  raise MissingRequirementException(f"Agent name must be specified.")
361
363
 
364
+ project_id = get_project_id()
365
+ agent_data = AgentClient(project_id=project_id).get_agent(agent_id=agent_name)
366
+ if 'errors' in agent_data:
367
+ raise InvalidAgentException(f"There is no agent with that name: {agent_data.get('errors')}")
368
+
362
369
  if use_gui:
363
370
  try:
364
- # Check if Streamlit is installed
365
371
  import streamlit
366
372
  except ImportError:
367
373
  logger.error("Streamlit not installed")
368
374
  Console.write_stderr("Streamlit is required for GUI mode. Install it with 'pip install streamlit'.")
369
375
  sys.exit(1)
370
376
 
371
- if use_gui:
372
- try:
373
- import streamlit
374
- except ImportError:
375
- logger.error("Streamlit not installed")
376
- Console.write_stderr("Streamlit is required for GUI mode. Install it with 'pip install streamlit'.")
377
- sys.exit(1)
377
+ try:
378
+ ui_path = resources.files("pygeai.chat").joinpath("ui.py")
379
+ ui_file_path = str(ui_path)
380
+
381
+ # Add the top-level project root to PYTHONPATH
382
+ package_root = str(Path(ui_file_path).resolve().parents[2])
383
+ env = os.environ.copy()
384
+ env["PYTHONPATH"] = package_root + os.pathsep + env.get("PYTHONPATH", "")
385
+
386
+ streamlit_cmd = [
387
+ sys.executable, "-m", "streamlit", "run", ui_file_path,
388
+ "--server.address", "127.0.0.1",
389
+ "--", "--agent-name", agent_name
390
+ ]
391
+
392
+ if platform.system() == "Linux":
393
+ streamlit_cmd.insert(5, "--server.headless=true")
394
+
395
+ process = subprocess.Popen(
396
+ streamlit_cmd,
397
+ stdout=subprocess.PIPE,
398
+ stderr=subprocess.PIPE,
399
+ text=True
400
+ )
378
401
 
379
- try:
380
- ui_path = resources.files("pygeai.chat").joinpath("ui.py")
381
- ui_file_path = str(ui_path)
382
-
383
- # Add the top-level project root to PYTHONPATH
384
- package_root = str(Path(ui_file_path).resolve().parents[2])
385
- env = os.environ.copy()
386
- env["PYTHONPATH"] = package_root + os.pathsep + env.get("PYTHONPATH", "")
387
-
388
- streamlit_cmd = [
389
- sys.executable, "-m", "streamlit", "run", ui_file_path,
390
- "--server.address", "127.0.0.1",
391
- "--", "--agent-name", agent_name
392
- ]
393
-
394
- if platform.system() == "Linux":
395
- streamlit_cmd.insert(5, "--server.headless=true")
396
-
397
- process = subprocess.Popen(
398
- streamlit_cmd,
399
- stdout=subprocess.PIPE,
400
- stderr=subprocess.PIPE,
401
- text=True
402
- )
403
-
404
- url = "http://localhost:8501"
405
- if platform.system() == "Linux":
406
- Console.write_stdout(f"Open Streamlit app at {url} (or next port like 8502 if 8501 is taken)")
407
-
408
- try:
409
- stdout, stderr = process.communicate()
410
- if stderr:
411
- logger.error(f"Streamlit stderr:\n{stderr}")
412
- Console.write_stderr(f"Streamlit error:\n{stderr}")
413
- except KeyboardInterrupt:
414
- process.terminate()
415
- Console.write_stdout("Streamlit stopped.")
416
- sys.exit(0)
402
+ url = "http://localhost:8501"
403
+ if platform.system() == "Linux":
404
+ Console.write_stdout(f"Open Streamlit app at {url} (or next port like 8502 if 8501 is taken)")
417
405
 
418
- except FileNotFoundError:
419
- logger.error("Could not locate pygeai/chat/ui.py")
420
- Console.write_stderr("Streamlit UI file not found. Ensure pygeai is installed correctly.")
421
- sys.exit(1)
422
- except Exception as e:
423
- logger.error(f"Streamlit error: {e}")
424
- Console.write_stderr(
425
- f"Failed to launch Streamlit. Check port with 'lsof -i :8501' and kill any process, or try {url}.")
426
- sys.exit(1)
406
+ try:
407
+ stdout, stderr = process.communicate()
408
+ if stderr:
409
+ logger.error(f"Streamlit stderr:\n{stderr}")
410
+ Console.write_stderr(f"Streamlit error:\n{stderr}")
411
+ except KeyboardInterrupt:
412
+ process.terminate()
413
+ Console.write_stdout("Streamlit stopped.")
414
+ sys.exit(0)
415
+
416
+ except FileNotFoundError:
417
+ logger.error("Could not locate pygeai/chat/ui.py")
418
+ Console.write_stderr("Streamlit UI file not found. Ensure pygeai is installed correctly.")
419
+ sys.exit(1)
420
+ except Exception as e:
421
+ logger.error(f"Streamlit error: {e}")
422
+ Console.write_stderr(
423
+ f"Failed to launch Streamlit. Check port with 'lsof -i :8501' and kill any process, or try {url}.")
424
+ sys.exit(1)
427
425
  else:
428
426
  chat_session = AgentChatSession(agent_name)
429
427
  messages = list()