pygeai 0.6.0b11__py3-none-any.whl → 0.6.0b13__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 (138) hide show
  1. pygeai/_docs/source/content/ai_lab/cli.rst +4 -4
  2. pygeai/_docs/source/content/ai_lab/models.rst +169 -35
  3. pygeai/_docs/source/content/ai_lab/runner.rst +2 -2
  4. pygeai/_docs/source/content/ai_lab/spec.rst +9 -9
  5. pygeai/_docs/source/content/ai_lab/usage.rst +34 -34
  6. pygeai/_docs/source/content/ai_lab.rst +1 -1
  7. pygeai/_docs/source/content/analytics.rst +598 -0
  8. pygeai/_docs/source/content/api_reference/chat.rst +428 -2
  9. pygeai/_docs/source/content/api_reference/embeddings.rst +1 -1
  10. pygeai/_docs/source/content/api_reference/project.rst +184 -0
  11. pygeai/_docs/source/content/api_reference/rag.rst +2 -2
  12. pygeai/_docs/source/content/authentication.rst +295 -0
  13. pygeai/_docs/source/content/cli.rst +79 -2
  14. pygeai/_docs/source/content/debugger.rst +1 -1
  15. pygeai/_docs/source/content/migration.rst +19 -2
  16. pygeai/_docs/source/index.rst +2 -0
  17. pygeai/_docs/source/pygeai.analytics.rst +53 -0
  18. pygeai/_docs/source/pygeai.cli.commands.rst +8 -0
  19. pygeai/_docs/source/pygeai.rst +1 -0
  20. pygeai/_docs/source/pygeai.tests.analytics.rst +45 -0
  21. pygeai/_docs/source/pygeai.tests.auth.rst +8 -0
  22. pygeai/_docs/source/pygeai.tests.rst +1 -1
  23. pygeai/analytics/__init__.py +0 -0
  24. pygeai/analytics/clients.py +505 -0
  25. pygeai/analytics/endpoints.py +35 -0
  26. pygeai/analytics/managers.py +606 -0
  27. pygeai/analytics/mappers.py +207 -0
  28. pygeai/analytics/responses.py +240 -0
  29. pygeai/assistant/managers.py +1 -1
  30. pygeai/chat/managers.py +1 -1
  31. pygeai/cli/commands/analytics.py +525 -0
  32. pygeai/cli/commands/base.py +16 -0
  33. pygeai/cli/commands/common.py +28 -24
  34. pygeai/cli/commands/migrate.py +75 -6
  35. pygeai/cli/commands/organization.py +265 -0
  36. pygeai/cli/commands/validators.py +144 -1
  37. pygeai/cli/error_handler.py +41 -6
  38. pygeai/cli/geai.py +106 -18
  39. pygeai/cli/parsers.py +75 -31
  40. pygeai/cli/texts/help.py +75 -6
  41. pygeai/core/base/clients.py +18 -4
  42. pygeai/core/base/session.py +59 -7
  43. pygeai/core/common/config.py +25 -2
  44. pygeai/core/common/exceptions.py +64 -1
  45. pygeai/core/embeddings/managers.py +1 -1
  46. pygeai/core/files/managers.py +1 -1
  47. pygeai/core/rerank/managers.py +1 -1
  48. pygeai/core/services/rest.py +20 -2
  49. pygeai/evaluation/clients.py +5 -3
  50. pygeai/lab/agents/clients.py +3 -3
  51. pygeai/lab/agents/endpoints.py +2 -2
  52. pygeai/lab/agents/mappers.py +50 -2
  53. pygeai/lab/clients.py +5 -2
  54. pygeai/lab/managers.py +8 -10
  55. pygeai/lab/models.py +70 -2
  56. pygeai/lab/tools/clients.py +1 -59
  57. pygeai/migration/__init__.py +3 -1
  58. pygeai/migration/strategies.py +72 -3
  59. pygeai/organization/clients.py +110 -1
  60. pygeai/organization/endpoints.py +11 -7
  61. pygeai/organization/limits/managers.py +1 -1
  62. pygeai/organization/managers.py +135 -3
  63. pygeai/organization/mappers.py +28 -2
  64. pygeai/organization/responses.py +11 -1
  65. pygeai/tests/analytics/__init__.py +0 -0
  66. pygeai/tests/analytics/test_clients.py +86 -0
  67. pygeai/tests/analytics/test_managers.py +94 -0
  68. pygeai/tests/analytics/test_mappers.py +84 -0
  69. pygeai/tests/analytics/test_responses.py +73 -0
  70. pygeai/tests/auth/test_oauth.py +172 -0
  71. pygeai/tests/cli/commands/test_migrate.py +14 -1
  72. pygeai/tests/cli/commands/test_organization.py +69 -1
  73. pygeai/tests/cli/test_error_handler.py +4 -4
  74. pygeai/tests/cli/test_geai_driver.py +1 -1
  75. pygeai/tests/lab/agents/test_mappers.py +128 -1
  76. pygeai/tests/lab/test_models.py +2 -0
  77. pygeai/tests/lab/tools/test_clients.py +2 -31
  78. pygeai/tests/organization/test_clients.py +180 -1
  79. pygeai/tests/organization/test_managers.py +40 -0
  80. pygeai/tests/snippets/analytics/__init__.py +0 -0
  81. pygeai/tests/snippets/analytics/get_agent_usage_per_user.py +16 -0
  82. pygeai/tests/snippets/analytics/get_agents_created_and_modified.py +11 -0
  83. pygeai/tests/snippets/analytics/get_average_cost_per_request.py +10 -0
  84. pygeai/tests/snippets/analytics/get_overall_error_rate.py +10 -0
  85. pygeai/tests/snippets/analytics/get_top_10_agents_by_requests.py +12 -0
  86. pygeai/tests/snippets/analytics/get_total_active_users.py +10 -0
  87. pygeai/tests/snippets/analytics/get_total_cost.py +10 -0
  88. pygeai/tests/snippets/analytics/get_total_requests_per_day.py +12 -0
  89. pygeai/tests/snippets/analytics/get_total_tokens.py +12 -0
  90. pygeai/tests/snippets/chat/get_response_complete_example.py +67 -0
  91. pygeai/tests/snippets/chat/get_response_with_instructions.py +19 -0
  92. pygeai/tests/snippets/chat/get_response_with_metadata.py +24 -0
  93. pygeai/tests/snippets/chat/get_response_with_parallel_tools.py +58 -0
  94. pygeai/tests/snippets/chat/get_response_with_reasoning.py +21 -0
  95. pygeai/tests/snippets/chat/get_response_with_store.py +38 -0
  96. pygeai/tests/snippets/chat/get_response_with_truncation.py +24 -0
  97. pygeai/tests/snippets/lab/agents/create_agent_with_permissions.py +39 -0
  98. pygeai/tests/snippets/lab/agents/create_agent_with_properties.py +46 -0
  99. pygeai/tests/snippets/lab/agents/get_agent_with_new_fields.py +62 -0
  100. pygeai/tests/snippets/lab/agents/update_agent_properties.py +50 -0
  101. pygeai/tests/snippets/organization/add_project_member.py +10 -0
  102. pygeai/tests/snippets/organization/add_project_member_batch.py +44 -0
  103. {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b13.dist-info}/METADATA +1 -1
  104. {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b13.dist-info}/RECORD +108 -98
  105. pygeai/_docs/source/pygeai.tests.snippets.assistants.data_analyst.rst +0 -37
  106. pygeai/_docs/source/pygeai.tests.snippets.assistants.rag.rst +0 -85
  107. pygeai/_docs/source/pygeai.tests.snippets.assistants.rst +0 -78
  108. pygeai/_docs/source/pygeai.tests.snippets.auth.rst +0 -10
  109. pygeai/_docs/source/pygeai.tests.snippets.chat.rst +0 -125
  110. pygeai/_docs/source/pygeai.tests.snippets.dbg.rst +0 -45
  111. pygeai/_docs/source/pygeai.tests.snippets.embeddings.rst +0 -61
  112. pygeai/_docs/source/pygeai.tests.snippets.evaluation.dataset.rst +0 -197
  113. pygeai/_docs/source/pygeai.tests.snippets.evaluation.plan.rst +0 -133
  114. pygeai/_docs/source/pygeai.tests.snippets.evaluation.result.rst +0 -37
  115. pygeai/_docs/source/pygeai.tests.snippets.evaluation.rst +0 -20
  116. pygeai/_docs/source/pygeai.tests.snippets.extras.rst +0 -37
  117. pygeai/_docs/source/pygeai.tests.snippets.files.rst +0 -53
  118. pygeai/_docs/source/pygeai.tests.snippets.gam.rst +0 -21
  119. pygeai/_docs/source/pygeai.tests.snippets.lab.agents.rst +0 -93
  120. pygeai/_docs/source/pygeai.tests.snippets.lab.processes.jobs.rst +0 -21
  121. pygeai/_docs/source/pygeai.tests.snippets.lab.processes.kbs.rst +0 -45
  122. pygeai/_docs/source/pygeai.tests.snippets.lab.processes.rst +0 -46
  123. pygeai/_docs/source/pygeai.tests.snippets.lab.rst +0 -82
  124. pygeai/_docs/source/pygeai.tests.snippets.lab.samples.rst +0 -21
  125. pygeai/_docs/source/pygeai.tests.snippets.lab.strategies.rst +0 -45
  126. pygeai/_docs/source/pygeai.tests.snippets.lab.tools.rst +0 -85
  127. pygeai/_docs/source/pygeai.tests.snippets.lab.use_cases.rst +0 -117
  128. pygeai/_docs/source/pygeai.tests.snippets.migrate.rst +0 -10
  129. pygeai/_docs/source/pygeai.tests.snippets.organization.rst +0 -109
  130. pygeai/_docs/source/pygeai.tests.snippets.rag.rst +0 -85
  131. pygeai/_docs/source/pygeai.tests.snippets.rerank.rst +0 -21
  132. pygeai/_docs/source/pygeai.tests.snippets.rst +0 -32
  133. pygeai/_docs/source/pygeai.tests.snippets.secrets.rst +0 -10
  134. pygeai/_docs/source/pygeai.tests.snippets.usage_limit.rst +0 -77
  135. {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b13.dist-info}/WHEEL +0 -0
  136. {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b13.dist-info}/entry_points.txt +0 -0
  137. {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b13.dist-info}/licenses/LICENSE +0 -0
  138. {pygeai-0.6.0b11.dist-info → pygeai-0.6.0b13.dist-info}/top_level.txt +0 -0
@@ -144,7 +144,7 @@ Using variables and thread ID:
144
144
  print(response)
145
145
 
146
146
  High Level Service Layer
147
- ^^^^^^^^^^^^^^^^^^^^^^^
147
+ ^^^^^^^^^^^^^^^^^^^^^^^^
148
148
 
149
149
  The `ChatManager` class provides a high-level interface for generating chat completions. It does not support streaming responses but simplifies the process by using structured models like `ChatMessageList` and `LlmSettings`.
150
150
 
@@ -325,4 +325,430 @@ With tool choice:
325
325
  tool_choice=tool_choice,
326
326
  tools=tools
327
327
  )
328
- print(response)
328
+ print(response)
329
+
330
+ Image Generation
331
+ ~~~~~~~~~~~~~~~~
332
+
333
+ The GEAI SDK provides functionality to generate images using AI models. This can be achieved through the command line interface or the low-level service layer (ChatClient).
334
+
335
+ Command Line
336
+ ^^^^^^^^^^^^
337
+
338
+ The `geai chat generate-image` command generates images based on the provided model and parameters.
339
+
340
+ .. code-block:: shell
341
+
342
+ geai chat generate-image \
343
+ --model "openai/dall-e-3" \
344
+ --prompt "A futuristic city with flying cars at sunset" \
345
+ --n 1 \
346
+ --quality "hd" \
347
+ --size "1024x1024" \
348
+ --aspect-ratio "1:1"
349
+
350
+ Generate multiple images with different aspect ratio:
351
+
352
+ .. code-block:: shell
353
+
354
+ geai chat generate-image \
355
+ --model "openai/dall-e-3" \
356
+ --prompt "A serene mountain landscape with a lake" \
357
+ --n 2 \
358
+ --quality "standard" \
359
+ --size "1792x1024" \
360
+ --aspect-ratio "16:9"
361
+
362
+ Low Level Service Layer
363
+ ^^^^^^^^^^^^^^^^^^^^^^^
364
+
365
+ The `ChatClient.generate_image` method provides a low-level interface to generate images.
366
+
367
+ .. code-block:: python
368
+
369
+ from pygeai.chat.clients import ChatClient
370
+
371
+ client = ChatClient()
372
+
373
+ response = client.generate_image(
374
+ model="openai/dall-e-3",
375
+ prompt="A futuristic city with flying cars at sunset",
376
+ n=1,
377
+ quality="hd",
378
+ size="1024x1024",
379
+ aspect_ratio="1:1"
380
+ )
381
+ print(response)
382
+
383
+ Generate images without aspect ratio specification:
384
+
385
+ .. code-block:: python
386
+
387
+ from pygeai.chat.clients import ChatClient
388
+
389
+ client = ChatClient()
390
+
391
+ response = client.generate_image(
392
+ model="openai/dall-e-3",
393
+ prompt="An abstract painting with vibrant colors",
394
+ n=1,
395
+ quality="standard",
396
+ size="1024x1024"
397
+ )
398
+ print(response)
399
+
400
+ Image Editing
401
+ ~~~~~~~~~~~~~
402
+
403
+ The GEAI SDK provides functionality to edit existing images using AI models. This can be achieved through the command line interface or the low-level service layer (ChatClient).
404
+
405
+ Command Line
406
+ ^^^^^^^^^^^^
407
+
408
+ The `geai chat edit-image` command edits an existing image based on the provided instructions.
409
+
410
+ .. code-block:: shell
411
+
412
+ geai chat edit-image \
413
+ --model "openai/dall-e-2" \
414
+ --prompt "Remove the ball from the image" \
415
+ --image "https://example.com/image.jpg" \
416
+ --size "1024x1024" \
417
+ --n 1 \
418
+ --quality "high"
419
+
420
+ Edit with multiple variations:
421
+
422
+ .. code-block:: shell
423
+
424
+ geai chat edit-image \
425
+ --model "openai/dall-e-2" \
426
+ --prompt "Change the background to a beach scene" \
427
+ --image "https://example.com/photo.jpg" \
428
+ --size "512x512" \
429
+ --n 3 \
430
+ --quality "standard"
431
+
432
+ Low Level Service Layer
433
+ ^^^^^^^^^^^^^^^^^^^^^^^
434
+
435
+ The `ChatClient.edit_image` method provides a low-level interface to edit images.
436
+
437
+ .. code-block:: python
438
+
439
+ from pygeai.chat.clients import ChatClient
440
+
441
+ client = ChatClient()
442
+
443
+ response = client.edit_image(
444
+ model="openai/dall-e-2",
445
+ prompt="Remove the ball from the image",
446
+ image="https://example.com/image.jpg",
447
+ size="1024x1024",
448
+ n=1,
449
+ quality="high"
450
+ )
451
+ print(response)
452
+
453
+ Edit with default parameters:
454
+
455
+ .. code-block:: python
456
+
457
+ from pygeai.chat.clients import ChatClient
458
+
459
+ client = ChatClient()
460
+
461
+ response = client.edit_image(
462
+ model="openai/dall-e-2",
463
+ prompt="Add a rainbow to the sky",
464
+ image="https://example.com/landscape.jpg",
465
+ size="512x512"
466
+ )
467
+ print(response)
468
+
469
+ Responses API
470
+ ~~~~~~~~~~~~~
471
+
472
+ The GEAI SDK provides a Responses API that supports processing images and PDF files alongside text input. This API is particularly useful for multi-modal applications that need to analyze documents or images.
473
+
474
+ Command Line
475
+ ^^^^^^^^^^^^
476
+
477
+ The `geai chat response` command generates a response using the Responses API with support for file uploads.
478
+
479
+ .. code-block:: shell
480
+
481
+ geai chat response \
482
+ --model "openai/gpt-4o" \
483
+ --input "What do you see in this image?" \
484
+ --files '["image.jpg"]' \
485
+ --temperature 0.7 \
486
+ --max-output-tokens 1000
487
+
488
+ Process multiple files with tools:
489
+
490
+ .. code-block:: shell
491
+
492
+ geai chat response \
493
+ --model "openai/gpt-4o" \
494
+ --input "Analyze these documents and extract key information" \
495
+ --files '["doc1.pdf", "doc2.pdf", "chart.jpg"]' \
496
+ --tools '[{"name": "extract_data", "description": "Extracts structured data", "parameters": {"type": "object"}}]' \
497
+ --tool-choice "auto" \
498
+ --temperature 0.5 \
499
+ --max-output-tokens 2000 \
500
+ --stream 1
501
+
502
+ With reasoning and metadata:
503
+
504
+ .. code-block:: shell
505
+
506
+ geai chat response \
507
+ --model "openai/o1-pro" \
508
+ --input "Solve this mathematical problem shown in the image" \
509
+ --files '["math_problem.jpg"]' \
510
+ --instructions "Show your work step by step" \
511
+ --reasoning '{"effort": "high"}' \
512
+ --metadata '{"task": "math_solving", "user_id": "123"}' \
513
+ --temperature 1.0
514
+
515
+ Low Level Service Layer
516
+ ^^^^^^^^^^^^^^^^^^^^^^^
517
+
518
+ The `ChatClient.get_response` method provides a low-level interface for the Responses API.
519
+
520
+ .. code-block:: python
521
+
522
+ from pygeai.chat.clients import ChatClient
523
+
524
+ client = ChatClient()
525
+
526
+ response = client.get_response(
527
+ model="openai/gpt-4o",
528
+ input="What do you see in this image?",
529
+ files=["image.jpg"],
530
+ temperature=0.7,
531
+ max_output_tokens=1000
532
+ )
533
+ print(response)
534
+
535
+ Streaming response with files:
536
+
537
+ .. code-block:: python
538
+
539
+ from pygeai.chat.clients import ChatClient
540
+
541
+ client = ChatClient()
542
+
543
+ response = client.get_response(
544
+ model="openai/gpt-4o",
545
+ input="Describe the content of these images",
546
+ files=["image1.jpg", "image2.jpg"],
547
+ stream=True,
548
+ temperature=0.7
549
+ )
550
+
551
+ for chunk in response:
552
+ print(chunk, end="")
553
+
554
+ With tools and advanced options:
555
+
556
+ .. code-block:: python
557
+
558
+ from pygeai.chat.clients import ChatClient
559
+
560
+ client = ChatClient()
561
+
562
+ tools = [
563
+ {
564
+ "name": "analyze_document",
565
+ "description": "Analyzes document content",
566
+ "parameters": {
567
+ "type": "object",
568
+ "properties": {
569
+ "topic": {"type": "string", "description": "Main topic"}
570
+ }
571
+ }
572
+ }
573
+ ]
574
+
575
+ response = client.get_response(
576
+ model="openai/gpt-4o",
577
+ input="Analyze this PDF and extract key topics",
578
+ files=["document.pdf"],
579
+ tools=tools,
580
+ tool_choice="auto",
581
+ temperature=0.5,
582
+ max_output_tokens=2000,
583
+ parallel_tool_calls=True,
584
+ metadata={"task": "document_analysis"},
585
+ user="user123"
586
+ )
587
+ print(response)
588
+
589
+ With reasoning configuration:
590
+
591
+ .. code-block:: python
592
+
593
+ from pygeai.chat.clients import ChatClient
594
+
595
+ client = ChatClient()
596
+
597
+ response = client.get_response(
598
+ model="openai/o1-pro",
599
+ input="Solve this complex problem from the image",
600
+ files=["problem.jpg"],
601
+ instructions="Think step by step and show your reasoning",
602
+ reasoning={"effort": "medium"},
603
+ temperature=1.0,
604
+ truncation="disabled",
605
+ store=True
606
+ )
607
+ print(response)
608
+
609
+ Interactive Chat with Iris
610
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
611
+
612
+ Iris is an AI assistant that helps guide users through the process of creating agents. The GEAI SDK provides an interactive chat interface for Iris.
613
+
614
+ Command Line
615
+ ^^^^^^^^^^^^
616
+
617
+ The `geai chat iris` command starts an interactive chat session with Iris.
618
+
619
+ .. code-block:: shell
620
+
621
+ geai chat iris
622
+
623
+ This opens an interactive prompt where you can ask Iris questions about creating and configuring agents. Type 'exit' or press Ctrl+C to close the chat.
624
+
625
+ Python API
626
+ ^^^^^^^^^^
627
+
628
+ The `Iris` class provides a programmatic interface to chat with Iris.
629
+
630
+ .. code-block:: python
631
+
632
+ from pygeai.chat.iris import Iris
633
+
634
+ iris = Iris()
635
+ messages = []
636
+
637
+ user_message = {
638
+ "role": "user",
639
+ "content": "I want to create an agent for customer support"
640
+ }
641
+ messages.append(user_message)
642
+
643
+ result = iris.stream_answer(messages)
644
+ answer = ""
645
+ for chunk in result:
646
+ answer += chunk
647
+ print(chunk, end="")
648
+
649
+ assistant_message = {
650
+ "role": "assistant",
651
+ "content": answer
652
+ }
653
+ messages.append(assistant_message)
654
+
655
+ Interactive Chat with Agents
656
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
657
+
658
+ The GEAI SDK provides functionality to have interactive chat sessions with agents. This includes both command-line and GUI interfaces, as well as session management capabilities.
659
+
660
+ Command Line
661
+ ^^^^^^^^^^^^
662
+
663
+ The `geai chat agent` command starts an interactive chat session with a specified agent.
664
+
665
+ Basic usage:
666
+
667
+ .. code-block:: shell
668
+
669
+ geai chat agent --agent-name "my-support-agent"
670
+
671
+ This opens an interactive prompt where you can chat with the agent. Type 'exit' or press Ctrl+C to close the chat.
672
+
673
+ With GUI interface:
674
+
675
+ .. code-block:: shell
676
+
677
+ geai chat agent --agent-name "my-support-agent" --gui
678
+
679
+ This launches a Streamlit-based graphical user interface for chatting with the agent. The GUI provides a more user-friendly experience with a web-based interface.
680
+
681
+ Note: The `--gui` option requires Streamlit to be installed. Install it with `pip install streamlit` if not already available.
682
+
683
+ Save conversation to a file:
684
+
685
+ .. code-block:: shell
686
+
687
+ geai chat agent --agent-name "my-support-agent" --save-session conversation.json
688
+
689
+ This saves the conversation history to `conversation.json` after each message exchange. The session is automatically saved when you exit the chat.
690
+
691
+ Restore a previous conversation:
692
+
693
+ .. code-block:: shell
694
+
695
+ geai chat agent --agent-name "my-support-agent" --restore-session conversation.json
696
+
697
+ This loads a previous conversation from `conversation.json` and continues the chat from where it left off. The conversation history is displayed before you can continue chatting.
698
+
699
+ Combine session save and restore:
700
+
701
+ .. code-block:: shell
702
+
703
+ geai chat agent --agent-name "my-support-agent" --restore-session old_conv.json --save-session new_conv.json
704
+
705
+ This restores the conversation from `old_conv.json` and saves all subsequent messages to `new_conv.json`.
706
+
707
+ Python API
708
+ ^^^^^^^^^^
709
+
710
+ The `AgentChatSession` class provides a programmatic interface to chat with agents.
711
+
712
+ .. code-block:: python
713
+
714
+ from pygeai.chat.session import AgentChatSession
715
+
716
+ session = AgentChatSession("my-support-agent")
717
+ messages = []
718
+
719
+ introduction = session.get_answer(
720
+ ["You're about to speak to a user. Introduce yourself in a clear and concise manner."]
721
+ )
722
+ print(f"Agent: {introduction}")
723
+
724
+ messages.append({"role": "assistant", "content": introduction})
725
+
726
+ user_message = {
727
+ "role": "user",
728
+ "content": "How can I reset my password?"
729
+ }
730
+ messages.append(user_message)
731
+
732
+ result = session.stream_answer(messages)
733
+ answer = ""
734
+ print("Agent: ", end="")
735
+ for chunk in result:
736
+ answer += chunk
737
+ print(chunk, end="")
738
+
739
+ messages.append({"role": "assistant", "content": answer})
740
+
741
+ Non-streaming chat:
742
+
743
+ .. code-block:: python
744
+
745
+ from pygeai.chat.session import AgentChatSession
746
+
747
+ session = AgentChatSession("my-support-agent")
748
+
749
+ user_messages = [
750
+ {"role": "user", "content": "What are your capabilities?"}
751
+ ]
752
+
753
+ answer = session.get_answer(user_messages)
754
+ print(f"Agent: {answer}")
@@ -7,7 +7,7 @@ The API Reference enables you to generate embeddings from various input types, i
7
7
 
8
8
 
9
9
  Generate embeddings
10
- ~~~~~~~~~~~~~~
10
+ ~~~~~~~~~~~~~~~~~~~
11
11
 
12
12
  Generates embeddings from different input types using `PyGEA </pygeai>`_. It can interact with several LLM providers and their respective models for embedding generation.
13
13
 
@@ -7,6 +7,7 @@ The API Reference provides a comprehensive set of tools for managing projects wi
7
7
  * Delete project: Deletes an existing project.
8
8
  * List projects: Retrieves a list of all projects within your organization. You can choose to retrieve a summary or detailed information for each project.
9
9
  * Update project: Updates the name and description of an existing project.
10
+ * Add project member: Sends an invitation email to add a user to a project with specific roles (supports individual and batch invitations).
10
11
 
11
12
  List projects
12
13
  ~~~~~~~~~~~~~~
@@ -464,6 +465,189 @@ Replace `<project_id>` with the actual project Id. For example:
464
465
  print(f"project: {project}")
465
466
 
466
467
 
468
+ Member Management
469
+ =================
470
+ You can manage project members to control access and permissions within your projects.
471
+
472
+ * Add Project Member: Sends an invitation email to add a user to a project with specific roles.
473
+
474
+ Add Project Member
475
+ ~~~~~~~~~~~~~~~~~~
476
+
477
+ Sends an invitation email to add a user to a project in `Globant Enterprise AI <https://wiki.genexus.com/enterprise-ai/wiki?8,Table+of+contents%3AEnterprise+AI>`_ using `PyGEA </pygeai>`_. You can add individual users or process multiple invitations via a CSV file (batch mode).
478
+
479
+ To achieve this, you have three options:
480
+
481
+ * `Command Line </docs/source/content/api_reference.rst#command-line>`_
482
+ * `Low-Level Service Layer </docs/source/content/api_reference.rst#low-level-service-layer>`_
483
+ * `High-Level Service Layer </docs/source/content/api_reference.rst#high-level-service-layer>`_
484
+
485
+ Command line
486
+ ^^^^^^^^^^^^
487
+
488
+ Add a single user to a project
489
+ ###############################
490
+
491
+ Use the following command to invite a user to a project:
492
+
493
+ .. code-block:: shell
494
+
495
+ geai org add-project-member \
496
+ --project-id <project_id> \
497
+ --email <user_email> \
498
+ --roles "<role1>,<role2>"
499
+
500
+ Replace the placeholders with the actual values:
501
+
502
+ * `<project_id>`: Id of the project.
503
+ * `<user_email>`: Email address of the user to invite.
504
+ * `<role1>,<role2>`: Comma-separated list of roles (e.g., "Project member,Project administrator").
505
+
506
+ For example:
507
+
508
+ .. code-block:: shell
509
+
510
+ geai org add-project-member \
511
+ --project-id 1956c032-3c66-4435-acb8-6a06e52f819f \
512
+ --email user@example.com \
513
+ --roles "Project member,Project administrator"
514
+
515
+ You can also use the short alias:
516
+
517
+ .. code-block:: shell
518
+
519
+ geai org apm \
520
+ --project-id 1956c032-3c66-4435-acb8-6a06e52f819f \
521
+ --email user@example.com \
522
+ --roles "Project member"
523
+
524
+
525
+ Add multiple users via CSV file (batch mode)
526
+ #############################################
527
+
528
+ Use the `-b` or `--batch` flag to process multiple invitations from a CSV file:
529
+
530
+ .. code-block:: shell
531
+
532
+ geai org add-project-member --batch <path_to_csv_file>
533
+
534
+ The CSV file format should be:
535
+
536
+ .. code-block:: text
537
+
538
+ project_id,email,role1,role2,...
539
+ 1956c032-3c66-4435-acb8-6a06e52f819f,user1@example.com,Project member
540
+ 1956c032-3c66-4435-acb8-6a06e52f819f,user2@example.com,Project member,Project administrator
541
+
542
+ For example:
543
+
544
+ .. code-block:: shell
545
+
546
+ geai org add-project-member --batch project_members.csv
547
+
548
+ The command will process each line and report successful and failed invitations.
549
+
550
+
551
+ Low level service layer
552
+ ^^^^^^^^^^^^^^^^^^^^^^^
553
+
554
+ Use the following code snippet to invite a user to a project using the low-level service layer:
555
+
556
+ .. code-block:: python
557
+
558
+ from pygeai.organization.clients import OrganizationClient
559
+
560
+ project_id = "<project_id>"
561
+ email = "<user_email>"
562
+ roles = ["Project member", "Project administrator"]
563
+
564
+ client = OrganizationClient()
565
+ result = client.add_project_member(project_id=project_id, email=email, roles=roles)
566
+ print(result)
567
+
568
+ Replace the placeholders with the actual values. For example:
569
+
570
+ .. code-block:: python
571
+
572
+ from pygeai.organization.clients import OrganizationClient
573
+
574
+ project_id = "1956c032-3c66-4435-acb8-6a06e52f819f"
575
+ email = "user@example.com"
576
+ roles = ["Project member", "Project administrator"]
577
+
578
+ client = OrganizationClient()
579
+ result = client.add_project_member(project_id=project_id, email=email, roles=roles)
580
+ print(result)
581
+
582
+ For batch processing, you can use:
583
+
584
+ .. code-block:: python
585
+
586
+ import csv
587
+ from pygeai.organization.clients import OrganizationClient
588
+
589
+ client = OrganizationClient()
590
+
591
+ with open('project_members.csv', 'r') as file:
592
+ csv_reader = csv.reader(file)
593
+ for row in csv_reader:
594
+ if len(row) >= 3:
595
+ project_id = row[0]
596
+ email = row[1]
597
+ roles = row[2:]
598
+ try:
599
+ result = client.add_project_member(
600
+ project_id=project_id,
601
+ email=email,
602
+ roles=roles
603
+ )
604
+ print(f"✓ Invited {email} to project {project_id}")
605
+ except Exception as e:
606
+ print(f"✗ Failed to invite {email}: {e}")
607
+
608
+
609
+ High level service layer
610
+ ^^^^^^^^^^^^^^^^^^^^^^^^
611
+
612
+ Use the following code snippet to invite a user to a project using the high-level service layer:
613
+
614
+ .. code-block:: python
615
+
616
+ from pygeai.organization.managers import OrganizationManager
617
+
618
+ manager = OrganizationManager()
619
+
620
+ project_id = "<project_id>"
621
+ email = "<user_email>"
622
+ roles = ["Project member", "Project administrator"]
623
+
624
+ response = manager.add_project_member(
625
+ project_id=project_id,
626
+ email=email,
627
+ roles=roles
628
+ )
629
+ print(f"response: {response}")
630
+
631
+ Replace the placeholders with the actual values. For example:
632
+
633
+ .. code-block:: python
634
+
635
+ from pygeai.organization.managers import OrganizationManager
636
+
637
+ manager = OrganizationManager()
638
+
639
+ project_id = "1956c032-3c66-4435-acb8-6a06e52f819f"
640
+ email = "user@example.com"
641
+ roles = ["Project member", "Project administrator"]
642
+
643
+ response = manager.add_project_member(
644
+ project_id=project_id,
645
+ email=email,
646
+ roles=roles
647
+ )
648
+ print(f"response: {response}")
649
+
650
+
467
651
  Token Management
468
652
  ================
469
653
  You can manage project tokens, which are essential for authentication and authorization when interacting with specific projects.
@@ -604,7 +604,7 @@ High-Level Service Layer
604
604
  An ``EmptyResponse`` indicating success, or an error response.
605
605
 
606
606
  Delete All Documents
607
- -------------------
607
+ --------------------
608
608
 
609
609
  Deletes all documents associated with a RAG Assistant.
610
610
 
@@ -620,7 +620,7 @@ Command Line
620
620
  * ``-n, --name``: (Required) Name of the RAG Assistant.
621
621
 
622
622
  Low-Level Service Layer
623
- ^^^^^^^^^^^^^^^^^^^^^^
623
+ ^^^^^^^^^^^^^^^^^^^^^^^
624
624
 
625
625
  .. code-block:: python
626
626