pygeai 0.6.0b13__py3-none-any.whl → 0.6.1__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.
- pygeai/__init__.py +1 -2
- pygeai/_docs/source/content/api_reference/project.rst +392 -0
- pygeai/_docs/source/content/authentication.rst +130 -1
- pygeai/_docs/source/content/debugger.rst +327 -157
- pygeai/_docs/source/content/migration.rst +391 -7
- pygeai/_docs/source/pygeai.core.common.rst +8 -0
- pygeai/_docs/source/pygeai.tests.auth.rst +56 -0
- pygeai/_docs/source/pygeai.tests.cli.rst +8 -0
- pygeai/admin/clients.py +1 -3
- pygeai/analytics/clients.py +1 -1
- pygeai/assistant/clients.py +2 -7
- pygeai/assistant/data/clients.py +0 -8
- pygeai/assistant/data_analyst/clients.py +0 -2
- pygeai/assistant/managers.py +1 -1
- pygeai/assistant/rag/clients.py +0 -2
- pygeai/assistant/rag/mappers.py +9 -11
- pygeai/auth/clients.py +26 -7
- pygeai/auth/endpoints.py +2 -1
- pygeai/chat/clients.py +2 -2
- pygeai/chat/managers.py +1 -1
- pygeai/cli/commands/admin.py +13 -25
- pygeai/cli/commands/analytics.py +56 -88
- pygeai/cli/commands/assistant.py +84 -138
- pygeai/cli/commands/auth.py +23 -46
- pygeai/cli/commands/base.py +0 -1
- pygeai/cli/commands/chat.py +218 -209
- pygeai/cli/commands/common.py +5 -5
- pygeai/cli/commands/configuration.py +79 -29
- pygeai/cli/commands/docs.py +3 -4
- pygeai/cli/commands/embeddings.py +13 -19
- pygeai/cli/commands/evaluation.py +133 -344
- pygeai/cli/commands/feedback.py +7 -15
- pygeai/cli/commands/files.py +26 -53
- pygeai/cli/commands/gam.py +28 -69
- pygeai/cli/commands/lab/ai_lab.py +96 -142
- pygeai/cli/commands/lab/common.py +1 -1
- pygeai/cli/commands/lab/spec.py +12 -32
- pygeai/cli/commands/llm.py +9 -18
- pygeai/cli/commands/migrate.py +43 -99
- pygeai/cli/commands/organization.py +223 -196
- pygeai/cli/commands/rag.py +35 -58
- pygeai/cli/commands/rerank.py +21 -25
- pygeai/cli/commands/secrets.py +39 -67
- pygeai/cli/commands/usage_limits.py +50 -136
- pygeai/cli/commands/validators.py +1 -1
- pygeai/cli/geai.py +32 -3
- pygeai/cli/geai_proxy.py +6 -2
- pygeai/cli/install_man.py +1 -1
- pygeai/cli/parsers.py +1 -1
- pygeai/core/base/clients.py +90 -21
- pygeai/core/base/mappers.py +39 -55
- pygeai/core/base/session.py +134 -22
- pygeai/core/common/config.py +50 -13
- pygeai/core/common/constants.py +8 -0
- pygeai/core/common/exceptions.py +6 -0
- pygeai/core/embeddings/clients.py +0 -1
- pygeai/core/embeddings/managers.py +0 -1
- pygeai/core/feedback/clients.py +0 -2
- pygeai/core/feedback/models.py +1 -1
- pygeai/core/files/clients.py +0 -3
- pygeai/core/files/managers.py +1 -1
- pygeai/core/files/mappers.py +4 -5
- pygeai/core/llm/clients.py +0 -1
- pygeai/core/models.py +4 -4
- pygeai/core/plugins/clients.py +0 -3
- pygeai/core/plugins/models.py +2 -2
- pygeai/core/rerank/clients.py +0 -2
- pygeai/core/secrets/clients.py +0 -2
- pygeai/core/services/rest.py +80 -14
- pygeai/core/singleton.py +24 -0
- pygeai/dbg/__init__.py +2 -2
- pygeai/dbg/debugger.py +276 -38
- pygeai/evaluation/clients.py +2 -4
- pygeai/evaluation/dataset/clients.py +0 -1
- pygeai/evaluation/plan/clients.py +0 -2
- pygeai/evaluation/result/clients.py +0 -2
- pygeai/gam/clients.py +1 -3
- pygeai/health/clients.py +1 -3
- pygeai/lab/clients.py +0 -1
- pygeai/lab/managers.py +0 -1
- pygeai/lab/models.py +0 -1
- pygeai/lab/strategies/clients.py +1 -2
- pygeai/lab/tools/clients.py +2 -2
- pygeai/lab/tools/mappers.py +1 -1
- pygeai/migration/strategies.py +5 -6
- pygeai/migration/tools.py +1 -1
- pygeai/organization/clients.py +118 -12
- pygeai/organization/endpoints.py +1 -0
- pygeai/organization/limits/clients.py +4 -6
- pygeai/organization/limits/managers.py +1 -4
- pygeai/organization/managers.py +2 -2
- pygeai/proxy/config.py +1 -0
- pygeai/proxy/managers.py +6 -5
- pygeai/tests/admin/test_clients.py +11 -11
- pygeai/tests/assistants/rag/test_clients.py +1 -1
- pygeai/tests/assistants/rag/test_models.py +1 -2
- pygeai/tests/assistants/test_clients.py +1 -1
- pygeai/tests/assistants/test_managers.py +1 -3
- pygeai/tests/auth/test_cli_configuration.py +252 -0
- pygeai/tests/auth/test_client_initialization.py +411 -0
- pygeai/tests/auth/test_clients.py +29 -27
- pygeai/tests/auth/test_config_manager.py +305 -0
- pygeai/tests/auth/test_header_injection.py +294 -0
- pygeai/tests/auth/test_oauth.py +3 -1
- pygeai/tests/auth/test_session_logging.py +119 -0
- pygeai/tests/auth/test_session_validation.py +408 -0
- pygeai/tests/auth/test_singleton_reset.py +201 -0
- pygeai/tests/chat/test_clients.py +1 -1
- pygeai/tests/chat/test_iris.py +1 -1
- pygeai/tests/chat/test_ui.py +0 -2
- pygeai/tests/cli/commands/lab/test_ai_lab.py +1 -3
- pygeai/tests/cli/commands/lab/test_common.py +0 -1
- pygeai/tests/cli/commands/test_chat.py +1 -1
- pygeai/tests/cli/commands/test_common.py +0 -1
- pygeai/tests/cli/commands/test_embeddings.py +2 -2
- pygeai/tests/cli/commands/test_evaluation.py +1 -9
- pygeai/tests/cli/commands/test_llm.py +1 -1
- pygeai/tests/cli/commands/test_migrate.py +1 -1
- pygeai/tests/cli/commands/test_rerank.py +0 -1
- pygeai/tests/cli/commands/test_secrets.py +1 -1
- pygeai/tests/cli/commands/test_show_help.py +0 -1
- pygeai/tests/cli/commands/test_validators.py +0 -1
- pygeai/tests/cli/test_credentials_flag.py +312 -0
- pygeai/tests/cli/test_error_handler.py +0 -1
- pygeai/tests/core/base/test_mappers.py +2 -2
- pygeai/tests/core/base/test_models.py +4 -4
- pygeai/tests/core/common/test_config.py +2 -7
- pygeai/tests/core/common/test_decorators.py +0 -1
- pygeai/tests/core/embeddings/test_managers.py +1 -1
- pygeai/tests/core/feedback/test_clients.py +2 -2
- pygeai/tests/core/files/test_clients.py +6 -6
- pygeai/tests/core/files/test_models.py +0 -1
- pygeai/tests/core/files/test_responses.py +0 -1
- pygeai/tests/core/llm/test_clients.py +1 -1
- pygeai/tests/core/plugins/test_clients.py +4 -4
- pygeai/tests/core/rerank/test_mappers.py +1 -3
- pygeai/tests/core/secrets/test_clients.py +2 -3
- pygeai/tests/core/services/test_rest.py +10 -10
- pygeai/tests/core/utils/test_console.py +0 -1
- pygeai/tests/dbg/test_debugger.py +95 -8
- pygeai/tests/evaluation/dataset/test_clients.py +24 -27
- pygeai/tests/evaluation/plan/test_clients.py +16 -18
- pygeai/tests/evaluation/result/test_clients.py +4 -5
- pygeai/tests/health/test_clients.py +2 -2
- pygeai/tests/integration/lab/agents/test_create_agent.py +1 -3
- pygeai/tests/integration/lab/agents/test_get_agent.py +1 -1
- pygeai/tests/integration/lab/processes/test_create_process.py +2 -2
- pygeai/tests/integration/lab/processes/test_create_task.py +2 -3
- pygeai/tests/integration/lab/processes/test_delete_process.py +0 -1
- pygeai/tests/integration/lab/processes/test_get_process.py +2 -4
- pygeai/tests/integration/lab/processes/test_list_process_instances.py +1 -3
- pygeai/tests/integration/lab/processes/test_update_process.py +3 -9
- pygeai/tests/integration/lab/reasoning_strategies/test_update_reasoning_strategy.py +1 -2
- pygeai/tests/integration/lab/tools/test_delete_tool.py +1 -1
- pygeai/tests/integration/lab/tools/test_list_tools.py +1 -1
- pygeai/tests/integration/lab/tools/test_update_tool.py +1 -1
- pygeai/tests/lab/agents/test_clients.py +17 -17
- pygeai/tests/lab/processes/test_clients.py +67 -67
- pygeai/tests/lab/processes/test_mappers.py +23 -23
- pygeai/tests/lab/spec/test_loader.py +0 -2
- pygeai/tests/lab/spec/test_parsers.py +1 -2
- pygeai/tests/lab/strategies/test_clients.py +10 -10
- pygeai/tests/lab/test_managers.py +3 -5
- pygeai/tests/lab/test_mappers.py +1 -4
- pygeai/tests/lab/tools/test_clients.py +21 -21
- pygeai/tests/lab/tools/test_mappers.py +0 -1
- pygeai/tests/organization/limits/test_clients.py +33 -33
- pygeai/tests/organization/limits/test_managers.py +7 -7
- pygeai/tests/organization/test_clients.py +78 -60
- pygeai/tests/proxy/test_clients.py +1 -1
- pygeai/tests/proxy/test_integration.py +1 -4
- pygeai/tests/proxy/test_managers.py +1 -2
- pygeai/tests/proxy/test_servers.py +1 -2
- pygeai/tests/snippets/assistants/rag/delete_rag_assistant.py +0 -1
- pygeai/tests/snippets/assistants/rag/get_documents.py +0 -1
- pygeai/tests/snippets/assistants/rag/get_rag_assistant_data.py +0 -1
- pygeai/tests/snippets/chat/get_request_status.py +0 -1
- pygeai/tests/snippets/dbg/file_debugging.py +72 -0
- pygeai/tests/snippets/dbg/module_debugging.py +60 -0
- pygeai/tests/snippets/embeddings/cohere_example.py +2 -2
- pygeai/tests/snippets/embeddings/openai_base64_example.py +1 -1
- pygeai/tests/snippets/evaluation/dataset/complete_workflow_example.py +8 -8
- pygeai/tests/snippets/evaluation/plan/complete_workflow_example.py +5 -5
- pygeai/tests/snippets/evaluation/result/complete_workflow_example.py +3 -3
- pygeai/tests/snippets/lab/agentic_flow_example_1.py +1 -1
- pygeai/tests/snippets/lab/agentic_flow_example_2.py +3 -4
- pygeai/tests/snippets/lab/agents/create_agent_with_permissions.py +2 -2
- pygeai/tests/snippets/lab/agents/delete_agent.py +1 -2
- pygeai/tests/snippets/lab/agents/get_agent.py +1 -1
- pygeai/tests/snippets/lab/agents/get_agent_with_new_fields.py +10 -10
- pygeai/tests/snippets/lab/agents/get_sharing_link.py +0 -1
- pygeai/tests/snippets/lab/agents/list_agents.py +1 -1
- pygeai/tests/snippets/lab/agents/publish_agent_revision.py +0 -1
- pygeai/tests/snippets/lab/agents/update_agent_properties.py +1 -1
- pygeai/tests/snippets/lab/crud_ui.py +3 -5
- pygeai/tests/snippets/lab/processes/kbs/get_kb.py +0 -1
- pygeai/tests/snippets/lab/processes/kbs/list_kbs.py +0 -1
- pygeai/tests/snippets/lab/processes/list_processes.py +1 -1
- pygeai/tests/snippets/lab/samples/summarize_files.py +0 -3
- pygeai/tests/snippets/lab/strategies/get_reasoning_strategy.py +0 -1
- pygeai/tests/snippets/lab/strategies/list_reasoning_strategies.py +1 -1
- pygeai/tests/snippets/lab/tools/get_tool.py +1 -1
- pygeai/tests/snippets/lab/tools/publish_tool_revision.py +0 -1
- pygeai/tests/snippets/lab/tools/set_parameters.py +1 -2
- pygeai/tests/snippets/lab/use_cases/c_code_fixer_agent_flow.py +2 -3
- pygeai/tests/snippets/lab/use_cases/file_summarizer_example_2.py +1 -1
- pygeai/tests/snippets/lab/use_cases/update_cli_expert.py +0 -1
- pygeai/tests/snippets/lab/use_cases/update_lab_expert.py +0 -1
- pygeai/tests/snippets/lab/use_cases/update_web_designer.py +0 -1
- pygeai/tests/snippets/lab/use_cases/update_web_reader.py +0 -1
- pygeai/tests/snippets/migrate/orchestrator_examples.py +1 -1
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/METADATA +32 -7
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/RECORD +217 -206
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/WHEEL +0 -0
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/entry_points.txt +0 -0
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/licenses/LICENSE +0 -0
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/top_level.txt +0 -0
pygeai/__init__.py
CHANGED
|
@@ -736,3 +736,395 @@ Replace `<project_id>` with the actual project Id. For example:
|
|
|
736
736
|
|
|
737
737
|
tokens: ProjectTokensResponse = client.get_project_tokens(project_id=project_id)
|
|
738
738
|
print(f"tokens: {tokens}")
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
Access Control
|
|
742
|
+
==============
|
|
743
|
+
The Access Control API provides tools to manage memberships, roles, and members across organizations and projects.
|
|
744
|
+
|
|
745
|
+
* Get Memberships: Retrieves organizations where you are a member.
|
|
746
|
+
* Get Project Memberships: Retrieves projects where a user is a member.
|
|
747
|
+
* Get Project Roles: Retrieves all roles supported by a specific project.
|
|
748
|
+
* Get Project Members: Retrieves all members and their roles for a specific project.
|
|
749
|
+
* Get Organization Members: Retrieves all members and their roles for a specific organization.
|
|
750
|
+
* Get Plugin Runtime Policies: Retrieves plugin runtime policies defined for an organization.
|
|
751
|
+
|
|
752
|
+
Get Memberships
|
|
753
|
+
~~~~~~~~~~~~~~~
|
|
754
|
+
|
|
755
|
+
Retrieves all organizations where you are a member using `PyGEA </pygeai>`_. Supports pagination and filtering options.
|
|
756
|
+
|
|
757
|
+
To achieve this, you have two options:
|
|
758
|
+
|
|
759
|
+
* `Command Line </docs/source/content/api_reference.rst#command-line>`_
|
|
760
|
+
* `Low-Level Service Layer </docs/source/content/api_reference.rst#low-level-service-layer>`_
|
|
761
|
+
|
|
762
|
+
Command line
|
|
763
|
+
^^^^^^^^^^^^
|
|
764
|
+
|
|
765
|
+
Use the following command to retrieve your organization memberships:
|
|
766
|
+
|
|
767
|
+
.. code-block:: shell
|
|
768
|
+
|
|
769
|
+
geai org get-memberships
|
|
770
|
+
|
|
771
|
+
With optional pagination parameters:
|
|
772
|
+
|
|
773
|
+
.. code-block:: shell
|
|
774
|
+
|
|
775
|
+
geai org get-memberships \
|
|
776
|
+
--start-page 1 \
|
|
777
|
+
--page-size 10 \
|
|
778
|
+
--order-direction asc
|
|
779
|
+
|
|
780
|
+
Low level service layer
|
|
781
|
+
^^^^^^^^^^^^^^^^^^^^^^^
|
|
782
|
+
|
|
783
|
+
Use the following code snippet to retrieve memberships:
|
|
784
|
+
|
|
785
|
+
.. code-block:: python
|
|
786
|
+
|
|
787
|
+
from pygeai.organization.clients import OrganizationClient
|
|
788
|
+
|
|
789
|
+
client = OrganizationClient()
|
|
790
|
+
result = client.get_memberships(
|
|
791
|
+
start_page=1,
|
|
792
|
+
page_size=10,
|
|
793
|
+
order_direction="asc"
|
|
794
|
+
)
|
|
795
|
+
print(result)
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
Get Project Memberships
|
|
799
|
+
~~~~~~~~~~~~~~~~~~~~~~~
|
|
800
|
+
|
|
801
|
+
Retrieves projects where a specific user is a member using `PyGEA </pygeai>`_. Supports pagination, sorting, and filtering by email.
|
|
802
|
+
|
|
803
|
+
To achieve this, you have two options:
|
|
804
|
+
|
|
805
|
+
* `Command Line </docs/source/content/api_reference.rst#command-line>`_
|
|
806
|
+
* `Low-Level Service Layer </docs/source/content/api_reference.rst#low-level-service-layer>`_
|
|
807
|
+
|
|
808
|
+
Command line
|
|
809
|
+
^^^^^^^^^^^^
|
|
810
|
+
|
|
811
|
+
Use the following command to retrieve project memberships for a specific user:
|
|
812
|
+
|
|
813
|
+
.. code-block:: shell
|
|
814
|
+
|
|
815
|
+
geai org get-project-memberships \
|
|
816
|
+
--email user@example.com \
|
|
817
|
+
--start-page 1 \
|
|
818
|
+
--page-size 10
|
|
819
|
+
|
|
820
|
+
With optional sorting and filtering:
|
|
821
|
+
|
|
822
|
+
.. code-block:: shell
|
|
823
|
+
|
|
824
|
+
geai org get-project-memberships \
|
|
825
|
+
--email user@example.com \
|
|
826
|
+
--start-page 1 \
|
|
827
|
+
--page-size 10 \
|
|
828
|
+
--order-key name \
|
|
829
|
+
--order-direction desc \
|
|
830
|
+
--role-types backend,frontend
|
|
831
|
+
|
|
832
|
+
Where:
|
|
833
|
+
|
|
834
|
+
* `--email`: User email address to filter by (required).
|
|
835
|
+
* `--start-page`: Page number for pagination (optional, default: 1).
|
|
836
|
+
* `--page-size`: Number of items per page (optional, default: 20).
|
|
837
|
+
* `--order-key`: Field for sorting (only 'name' supported, optional).
|
|
838
|
+
* `--order-direction`: Sort direction: 'asc' or 'desc' (optional, default: 'desc').
|
|
839
|
+
* `--role-types`: Comma-separated list of role types (optional, case-insensitive).
|
|
840
|
+
|
|
841
|
+
Low level service layer
|
|
842
|
+
^^^^^^^^^^^^^^^^^^^^^^^
|
|
843
|
+
|
|
844
|
+
Use the following code snippet to retrieve project memberships:
|
|
845
|
+
|
|
846
|
+
.. code-block:: python
|
|
847
|
+
|
|
848
|
+
from pygeai.organization.clients import OrganizationClient
|
|
849
|
+
|
|
850
|
+
client = OrganizationClient()
|
|
851
|
+
result = client.get_project_memberships(
|
|
852
|
+
email="user@example.com",
|
|
853
|
+
start_page=1,
|
|
854
|
+
page_size=10,
|
|
855
|
+
order_key="name",
|
|
856
|
+
order_direction="desc",
|
|
857
|
+
role_types="backend,frontend"
|
|
858
|
+
)
|
|
859
|
+
print(result)
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
Get Project Roles
|
|
863
|
+
~~~~~~~~~~~~~~~~~
|
|
864
|
+
|
|
865
|
+
Retrieves all roles supported by a specific project using `PyGEA </pygeai>`_. Supports pagination, sorting, and filtering by role types.
|
|
866
|
+
|
|
867
|
+
To achieve this, you have two options:
|
|
868
|
+
|
|
869
|
+
* `Command Line </docs/source/content/api_reference.rst#command-line>`_
|
|
870
|
+
* `Low-Level Service Layer </docs/source/content/api_reference.rst#low-level-service-layer>`_
|
|
871
|
+
|
|
872
|
+
Command line
|
|
873
|
+
^^^^^^^^^^^^
|
|
874
|
+
|
|
875
|
+
Use the following command to retrieve project roles:
|
|
876
|
+
|
|
877
|
+
.. code-block:: shell
|
|
878
|
+
|
|
879
|
+
geai org get-project-roles \
|
|
880
|
+
--project-id <project_id>
|
|
881
|
+
|
|
882
|
+
With optional pagination and filtering:
|
|
883
|
+
|
|
884
|
+
.. code-block:: shell
|
|
885
|
+
|
|
886
|
+
geai org get-project-roles \
|
|
887
|
+
--project-id 12345678-90ab-cdef-1234-567890abcdef \
|
|
888
|
+
--start-page 1 \
|
|
889
|
+
--page-size 10 \
|
|
890
|
+
--order-key name \
|
|
891
|
+
--order-direction asc \
|
|
892
|
+
--role-types backend
|
|
893
|
+
|
|
894
|
+
Where:
|
|
895
|
+
|
|
896
|
+
* `--project-id`: The unique identifier (GUID) of the project (required).
|
|
897
|
+
* `--start-page`: Page number for pagination (optional, default: 1).
|
|
898
|
+
* `--page-size`: Number of items per page (optional, default: 20).
|
|
899
|
+
* `--order-key`: Field for sorting (only 'name' supported, optional).
|
|
900
|
+
* `--order-direction`: Sort direction: 'asc' or 'desc' (optional, default: 'desc').
|
|
901
|
+
* `--role-types`: Comma-separated list of role types: 'backend', 'frontend' (optional, case-insensitive).
|
|
902
|
+
|
|
903
|
+
Low level service layer
|
|
904
|
+
^^^^^^^^^^^^^^^^^^^^^^^
|
|
905
|
+
|
|
906
|
+
Use the following code snippet to retrieve project roles:
|
|
907
|
+
|
|
908
|
+
.. code-block:: python
|
|
909
|
+
|
|
910
|
+
from pygeai.organization.clients import OrganizationClient
|
|
911
|
+
|
|
912
|
+
project_id = "12345678-90ab-cdef-1234-567890abcdef"
|
|
913
|
+
|
|
914
|
+
client = OrganizationClient()
|
|
915
|
+
result = client.get_project_roles(
|
|
916
|
+
project_id=project_id,
|
|
917
|
+
start_page=1,
|
|
918
|
+
page_size=10,
|
|
919
|
+
order_key="name",
|
|
920
|
+
order_direction="asc",
|
|
921
|
+
role_types="backend"
|
|
922
|
+
)
|
|
923
|
+
print(result)
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
Get Project Members
|
|
927
|
+
~~~~~~~~~~~~~~~~~~~
|
|
928
|
+
|
|
929
|
+
Retrieves all members and their roles for a specific project using `PyGEA </pygeai>`_. Supports pagination, sorting, and filtering by role types.
|
|
930
|
+
|
|
931
|
+
To achieve this, you have two options:
|
|
932
|
+
|
|
933
|
+
* `Command Line </docs/source/content/api_reference.rst#command-line>`_
|
|
934
|
+
* `Low-Level Service Layer </docs/source/content/api_reference.rst#low-level-service-layer>`_
|
|
935
|
+
|
|
936
|
+
Command line
|
|
937
|
+
^^^^^^^^^^^^
|
|
938
|
+
|
|
939
|
+
Use the following command to retrieve project members:
|
|
940
|
+
|
|
941
|
+
.. code-block:: shell
|
|
942
|
+
|
|
943
|
+
geai org get-project-members \
|
|
944
|
+
--project-id <project_id>
|
|
945
|
+
|
|
946
|
+
With optional pagination and filtering:
|
|
947
|
+
|
|
948
|
+
.. code-block:: shell
|
|
949
|
+
|
|
950
|
+
geai org get-project-members \
|
|
951
|
+
--project-id 12345678-90ab-cdef-1234-567890abcdef \
|
|
952
|
+
--start-page 1 \
|
|
953
|
+
--page-size 10 \
|
|
954
|
+
--order-key name \
|
|
955
|
+
--order-direction desc \
|
|
956
|
+
--role-types backend,frontend
|
|
957
|
+
|
|
958
|
+
Where:
|
|
959
|
+
|
|
960
|
+
* `--project-id`: The unique identifier (GUID) of the project (required).
|
|
961
|
+
* `--start-page`: Page number for pagination (optional, default: 1).
|
|
962
|
+
* `--page-size`: Number of items per page (optional, default: 20).
|
|
963
|
+
* `--order-key`: Field for sorting (only 'name' supported, optional).
|
|
964
|
+
* `--order-direction`: Sort direction: 'asc' or 'desc' (optional, default: 'desc').
|
|
965
|
+
* `--role-types`: Comma-separated list of role types: 'backend', 'frontend' (optional, case-insensitive).
|
|
966
|
+
|
|
967
|
+
Low level service layer
|
|
968
|
+
^^^^^^^^^^^^^^^^^^^^^^^
|
|
969
|
+
|
|
970
|
+
Use the following code snippet to retrieve project members:
|
|
971
|
+
|
|
972
|
+
.. code-block:: python
|
|
973
|
+
|
|
974
|
+
from pygeai.organization.clients import OrganizationClient
|
|
975
|
+
|
|
976
|
+
project_id = "12345678-90ab-cdef-1234-567890abcdef"
|
|
977
|
+
|
|
978
|
+
client = OrganizationClient()
|
|
979
|
+
result = client.get_project_members(
|
|
980
|
+
project_id=project_id,
|
|
981
|
+
start_page=1,
|
|
982
|
+
page_size=10,
|
|
983
|
+
order_key="name",
|
|
984
|
+
order_direction="desc",
|
|
985
|
+
role_types="backend,frontend"
|
|
986
|
+
)
|
|
987
|
+
print(result)
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
Get Organization Members
|
|
991
|
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
992
|
+
|
|
993
|
+
Retrieves all members and their roles for a specific organization using `PyGEA </pygeai>`_. Supports pagination, sorting, and filtering by role types.
|
|
994
|
+
|
|
995
|
+
To achieve this, you have two options:
|
|
996
|
+
|
|
997
|
+
* `Command Line </docs/source/content/api_reference.rst#command-line>`_
|
|
998
|
+
* `Low-Level Service Layer </docs/source/content/api_reference.rst#low-level-service-layer>`_
|
|
999
|
+
|
|
1000
|
+
Command line
|
|
1001
|
+
^^^^^^^^^^^^
|
|
1002
|
+
|
|
1003
|
+
Use the following command to retrieve organization members:
|
|
1004
|
+
|
|
1005
|
+
.. code-block:: shell
|
|
1006
|
+
|
|
1007
|
+
geai org get-organization-members \
|
|
1008
|
+
--organization-id <organization_id>
|
|
1009
|
+
|
|
1010
|
+
With optional pagination and filtering:
|
|
1011
|
+
|
|
1012
|
+
.. code-block:: shell
|
|
1013
|
+
|
|
1014
|
+
geai org get-organization-members \
|
|
1015
|
+
--organization-id 12345678-90ab-cdef-1234-567890abcdef \
|
|
1016
|
+
--start-page 1 \
|
|
1017
|
+
--page-size 10 \
|
|
1018
|
+
--order-key email \
|
|
1019
|
+
--order-direction asc \
|
|
1020
|
+
--role-types backend
|
|
1021
|
+
|
|
1022
|
+
Where:
|
|
1023
|
+
|
|
1024
|
+
* `--organization-id` or `--oid`: The unique identifier (GUID) of the organization (required).
|
|
1025
|
+
* `--start-page`: Page number for pagination (optional, default: 1).
|
|
1026
|
+
* `--page-size`: Number of items per page (optional, default: 20).
|
|
1027
|
+
* `--order-key`: Field for sorting (only 'email' supported, optional).
|
|
1028
|
+
* `--order-direction`: Sort direction: 'asc' or 'desc' (optional, default: 'desc').
|
|
1029
|
+
* `--role-types`: Comma-separated list of role types. Only 'backend' is supported for organizations (optional, case-insensitive).
|
|
1030
|
+
|
|
1031
|
+
Low level service layer
|
|
1032
|
+
^^^^^^^^^^^^^^^^^^^^^^^
|
|
1033
|
+
|
|
1034
|
+
Use the following code snippet to retrieve organization members:
|
|
1035
|
+
|
|
1036
|
+
.. code-block:: python
|
|
1037
|
+
|
|
1038
|
+
from pygeai.organization.clients import OrganizationClient
|
|
1039
|
+
|
|
1040
|
+
organization_id = "12345678-90ab-cdef-1234-567890abcdef"
|
|
1041
|
+
|
|
1042
|
+
client = OrganizationClient()
|
|
1043
|
+
result = client.get_organization_members(
|
|
1044
|
+
organization_id=organization_id,
|
|
1045
|
+
start_page=1,
|
|
1046
|
+
page_size=10,
|
|
1047
|
+
order_key="email",
|
|
1048
|
+
order_direction="asc",
|
|
1049
|
+
role_types="backend"
|
|
1050
|
+
)
|
|
1051
|
+
print(result)
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
Get Plugin Runtime Policies
|
|
1055
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
1056
|
+
|
|
1057
|
+
Retrieves the plugin runtime policies defined for a given organization using `PyGEA </pygeai>`_. If no policies are defined, the response indicates that individual policies will apply.
|
|
1058
|
+
|
|
1059
|
+
Plugin runtime policies control permissions for organization agents at The Station, including chat sharing and external execution permissions.
|
|
1060
|
+
|
|
1061
|
+
To achieve this, you have two options:
|
|
1062
|
+
|
|
1063
|
+
* `Command Line </docs/source/content/api_reference.rst#command-line>`_
|
|
1064
|
+
* `Low-Level Service Layer </docs/source/content/api_reference.rst#low-level-service-layer>`_
|
|
1065
|
+
|
|
1066
|
+
Command line
|
|
1067
|
+
^^^^^^^^^^^^
|
|
1068
|
+
|
|
1069
|
+
Use the following command to retrieve plugin runtime policies:
|
|
1070
|
+
|
|
1071
|
+
.. code-block:: shell
|
|
1072
|
+
|
|
1073
|
+
geai org get-plugin-runtime-policies \
|
|
1074
|
+
--organization-id <organization_id>
|
|
1075
|
+
|
|
1076
|
+
Replace `<organization_id>` with the actual organization GUID. For example:
|
|
1077
|
+
|
|
1078
|
+
.. code-block:: shell
|
|
1079
|
+
|
|
1080
|
+
geai org get-plugin-runtime-policies \
|
|
1081
|
+
--organization-id 12345678-90ab-cdef-1234-567890abcdef
|
|
1082
|
+
|
|
1083
|
+
You can also use the short alias:
|
|
1084
|
+
|
|
1085
|
+
.. code-block:: shell
|
|
1086
|
+
|
|
1087
|
+
geai org get-plugin-runtime-policies --oid 12345678-90ab-cdef-1234-567890abcdef
|
|
1088
|
+
|
|
1089
|
+
**Response Examples:**
|
|
1090
|
+
|
|
1091
|
+
1. **Organizations without policies:**
|
|
1092
|
+
|
|
1093
|
+
.. code-block:: json
|
|
1094
|
+
|
|
1095
|
+
{
|
|
1096
|
+
"messages": {
|
|
1097
|
+
"description": "Organization plugin runtime policies not defined. Individual policy will apply."
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
2. **Organizations with policies:**
|
|
1102
|
+
|
|
1103
|
+
.. code-block:: json
|
|
1104
|
+
|
|
1105
|
+
{
|
|
1106
|
+
"policies": {
|
|
1107
|
+
"chatSharingPermissions": "project",
|
|
1108
|
+
"externalExecutionPermissions": "organization"
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
Where:
|
|
1113
|
+
|
|
1114
|
+
- `chatSharingPermissions`: Maximum execution permissions for organization Agents. Values: "none", "project", "organization".
|
|
1115
|
+
- `externalExecutionPermissions`: Allows sharing conversation by anonymous users. Values: "none", "project", "organization".
|
|
1116
|
+
|
|
1117
|
+
Low level service layer
|
|
1118
|
+
^^^^^^^^^^^^^^^^^^^^^^^
|
|
1119
|
+
|
|
1120
|
+
Use the following code snippet to retrieve plugin runtime policies:
|
|
1121
|
+
|
|
1122
|
+
.. code-block:: python
|
|
1123
|
+
|
|
1124
|
+
from pygeai.organization.clients import OrganizationClient
|
|
1125
|
+
|
|
1126
|
+
organization_id = "12345678-90ab-cdef-1234-567890abcdef"
|
|
1127
|
+
|
|
1128
|
+
client = OrganizationClient()
|
|
1129
|
+
result = client.get_plugin_runtime_policies(organization_id=organization_id)
|
|
1130
|
+
print(result)
|
|
@@ -27,6 +27,8 @@ When prompted, enter your API key and base URL:
|
|
|
27
27
|
-> Insert your GEAI API BASE URL: https://api.saia.ai
|
|
28
28
|
GEAI API BASE URL for alias 'default' saved successfully!
|
|
29
29
|
|
|
30
|
+
The ``geai configure`` command creates or updates the credentials file at ``~/.geai/credentials`` with the specified alias profile.
|
|
31
|
+
|
|
30
32
|
Usage in Code
|
|
31
33
|
~~~~~~~~~~~~~
|
|
32
34
|
|
|
@@ -258,6 +260,127 @@ The SDK validates authentication parameters:
|
|
|
258
260
|
project_id="project-123"
|
|
259
261
|
)
|
|
260
262
|
|
|
263
|
+
Advanced Features
|
|
264
|
+
-----------------
|
|
265
|
+
|
|
266
|
+
Mixed Authentication
|
|
267
|
+
~~~~~~~~~~~~~~~~~~~~
|
|
268
|
+
|
|
269
|
+
The SDK supports using both API Key and OAuth 2.0 authentication simultaneously through the ``allow_mixed_auth`` parameter. When both are provided, OAuth takes precedence.
|
|
270
|
+
|
|
271
|
+
.. code-block:: python
|
|
272
|
+
|
|
273
|
+
from pygeai.lab.clients import AILabClient
|
|
274
|
+
|
|
275
|
+
client = AILabClient(
|
|
276
|
+
api_key="your_api_key",
|
|
277
|
+
base_url="https://api.saia.ai",
|
|
278
|
+
access_token="your_oauth_token",
|
|
279
|
+
project_id="your-project-id",
|
|
280
|
+
allow_mixed_auth=True # Required when providing both
|
|
281
|
+
)
|
|
282
|
+
# OAuth authentication will be used (takes precedence)
|
|
283
|
+
|
|
284
|
+
**Validation:**
|
|
285
|
+
|
|
286
|
+
- If both ``api_key`` and ``access_token`` are provided without ``allow_mixed_auth=True``, a ``MixedAuthenticationException`` is raised.
|
|
287
|
+
- When mixed auth is allowed, OAuth 2.0 (``access_token``) takes precedence over the API key.
|
|
288
|
+
|
|
289
|
+
Organization ID
|
|
290
|
+
~~~~~~~~~~~~~~~
|
|
291
|
+
|
|
292
|
+
The optional ``organization_id`` parameter provides organization-level context for API requests:
|
|
293
|
+
|
|
294
|
+
.. code-block:: python
|
|
295
|
+
|
|
296
|
+
client = AILabClient(
|
|
297
|
+
base_url="https://api.saia.ai",
|
|
298
|
+
access_token="your_oauth_token",
|
|
299
|
+
project_id="your-project-id",
|
|
300
|
+
organization_id="your-org-id"
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
When provided, the SDK automatically includes the ``OrganizationId`` header in API requests.
|
|
304
|
+
|
|
305
|
+
Environment Variables
|
|
306
|
+
~~~~~~~~~~~~~~~~~~~~~
|
|
307
|
+
|
|
308
|
+
All authentication parameters can be configured via environment variables:
|
|
309
|
+
|
|
310
|
+
**API Key Authentication:**
|
|
311
|
+
|
|
312
|
+
- ``GEAI_API_KEY`` - Your API key
|
|
313
|
+
- ``GEAI_API_BASE_URL`` - Base URL for the API
|
|
314
|
+
- ``GEAI_PROJECT_ID`` - (Optional) Project ID
|
|
315
|
+
|
|
316
|
+
**OAuth 2.0 Authentication:**
|
|
317
|
+
|
|
318
|
+
- ``GEAI_OAUTH_ACCESS_TOKEN`` - Your OAuth 2.0 access token
|
|
319
|
+
- ``GEAI_PROJECT_ID`` - Your project ID (required with OAuth)
|
|
320
|
+
- ``GEAI_API_BASE_URL`` - Base URL for the API
|
|
321
|
+
- ``GEAI_ORGANIZATION_ID`` - (Optional) Organization ID
|
|
322
|
+
|
|
323
|
+
**Example:**
|
|
324
|
+
|
|
325
|
+
.. code-block:: shell
|
|
326
|
+
|
|
327
|
+
export GEAI_OAUTH_ACCESS_TOKEN="your_oauth_token"
|
|
328
|
+
export GEAI_PROJECT_ID="your-project-id"
|
|
329
|
+
export GEAI_API_BASE_URL="https://api.saia.ai"
|
|
330
|
+
export GEAI_ORGANIZATION_ID="your-org-id"
|
|
331
|
+
|
|
332
|
+
Session Utilities
|
|
333
|
+
~~~~~~~~~~~~~~~~~
|
|
334
|
+
|
|
335
|
+
The SDK provides utility methods to inspect the current authentication state:
|
|
336
|
+
|
|
337
|
+
.. code-block:: python
|
|
338
|
+
|
|
339
|
+
from pygeai.core.base.session import get_session
|
|
340
|
+
from pygeai.core.common.constants import AuthType
|
|
341
|
+
|
|
342
|
+
session = get_session()
|
|
343
|
+
|
|
344
|
+
# Check authentication type
|
|
345
|
+
if session.is_oauth():
|
|
346
|
+
print("Using OAuth 2.0 authentication")
|
|
347
|
+
print(f"Project ID: {session.project_id}")
|
|
348
|
+
elif session.is_api_key():
|
|
349
|
+
print("Using API Key authentication")
|
|
350
|
+
|
|
351
|
+
# Get the active token
|
|
352
|
+
active_token = session.get_active_token()
|
|
353
|
+
|
|
354
|
+
# Check auth type enum
|
|
355
|
+
if session.auth_type == AuthType.OAUTH_TOKEN:
|
|
356
|
+
print("OAuth authentication active")
|
|
357
|
+
elif session.auth_type == AuthType.API_KEY:
|
|
358
|
+
print("API Key authentication active")
|
|
359
|
+
elif session.auth_type == AuthType.NONE:
|
|
360
|
+
print("No authentication configured")
|
|
361
|
+
|
|
362
|
+
Warning Behaviors
|
|
363
|
+
~~~~~~~~~~~~~~~~~
|
|
364
|
+
|
|
365
|
+
The SDK provides helpful warnings in the following scenarios:
|
|
366
|
+
|
|
367
|
+
1. **Project ID without OAuth token**: If ``project_id`` is provided without ``access_token``, a ``UserWarning`` is issued since project_id is only used with OAuth 2.0.
|
|
368
|
+
|
|
369
|
+
2. **No authentication configured**: If neither ``api_key`` nor ``access_token`` is provided, a warning is logged.
|
|
370
|
+
|
|
371
|
+
3. **Missing base URL**: If ``base_url`` is not configured, a warning is logged.
|
|
372
|
+
|
|
373
|
+
4. **Mixed authentication in config**: When loading credentials from a config file that contains both API key and OAuth parameters, a warning is logged indicating OAuth will take precedence.
|
|
374
|
+
|
|
375
|
+
Exception Reference
|
|
376
|
+
~~~~~~~~~~~~~~~~~~~
|
|
377
|
+
|
|
378
|
+
The SDK raises specific exceptions for authentication errors:
|
|
379
|
+
|
|
380
|
+
- ``MissingRequirementException``: Raised when OAuth ``access_token`` is provided without required ``project_id``.
|
|
381
|
+
- ``MixedAuthenticationException``: Raised when both ``api_key`` and ``access_token`` are provided without ``allow_mixed_auth=True``.
|
|
382
|
+
- ``APIResponseError``: Raised for API-level authentication failures (invalid tokens, expired tokens, etc.).
|
|
383
|
+
|
|
261
384
|
Best Practices
|
|
262
385
|
--------------
|
|
263
386
|
|
|
@@ -273,7 +396,11 @@ Best Practices
|
|
|
273
396
|
|
|
274
397
|
.. code-block:: python
|
|
275
398
|
|
|
276
|
-
from pygeai.core.common.exceptions import
|
|
399
|
+
from pygeai.core.common.exceptions import (
|
|
400
|
+
MissingRequirementException,
|
|
401
|
+
MixedAuthenticationException,
|
|
402
|
+
APIResponseError
|
|
403
|
+
)
|
|
277
404
|
|
|
278
405
|
try:
|
|
279
406
|
client = AILabClient(
|
|
@@ -284,6 +411,8 @@ Best Practices
|
|
|
284
411
|
agents = client.list_agents()
|
|
285
412
|
except MissingRequirementException as e:
|
|
286
413
|
print(f"Configuration error: {e}")
|
|
414
|
+
except MixedAuthenticationException as e:
|
|
415
|
+
print(f"Mixed authentication error: {e}")
|
|
287
416
|
except APIResponseError as e:
|
|
288
417
|
print(f"Authentication failed: {e}")
|
|
289
418
|
|