giga-sdk 0.7.1__tar.gz
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.
- giga_sdk-0.7.1/.github/workflows/pypi-release.yml +40 -0
- giga_sdk-0.7.1/.gitignore +10 -0
- giga_sdk-0.7.1/PKG-INFO +101 -0
- giga_sdk-0.7.1/README.md +69 -0
- giga_sdk-0.7.1/giga/__about__.py +3 -0
- giga_sdk-0.7.1/giga/__init__.py +117 -0
- giga_sdk-0.7.1/giga/agent.py +460 -0
- giga_sdk-0.7.1/giga/agent_loader/__init__.py +23 -0
- giga_sdk-0.7.1/giga/agent_loader/actions.py +50 -0
- giga_sdk-0.7.1/giga/agent_loader/agent_snapshot.py +333 -0
- giga_sdk-0.7.1/giga/agent_loader/models.py +64 -0
- giga_sdk-0.7.1/giga/agent_loader/module_loader.py +82 -0
- giga_sdk-0.7.1/giga/agent_loader/shared_code.py +86 -0
- giga_sdk-0.7.1/giga/api.py +140 -0
- giga_sdk-0.7.1/giga/ast_utils.py +175 -0
- giga_sdk-0.7.1/giga/cli/CLAUDE.md +26 -0
- giga_sdk-0.7.1/giga/cli/__init__.py +1 -0
- giga_sdk-0.7.1/giga/cli/_app/__init__.py +0 -0
- giga_sdk-0.7.1/giga/cli/_app/__main__.py +16 -0
- giga_sdk-0.7.1/giga/cli/_app/app.py +88 -0
- giga_sdk-0.7.1/giga/cli/_app/main_typer.py +31 -0
- giga_sdk-0.7.1/giga/cli/api/__init__.py +0 -0
- giga_sdk-0.7.1/giga/cli/api/_superjson.py +29 -0
- giga_sdk-0.7.1/giga/cli/api/agents_client.py +192 -0
- giga_sdk-0.7.1/giga/cli/api/analytics/__init__.py +29 -0
- giga_sdk-0.7.1/giga/cli/api/analytics/custom_fields_client.py +169 -0
- giga_sdk-0.7.1/giga/cli/api/analytics/jobs_client.py +62 -0
- giga_sdk-0.7.1/giga/cli/api/auth.py +209 -0
- giga_sdk-0.7.1/giga/cli/api/base_client.py +171 -0
- giga_sdk-0.7.1/giga/cli/api/callback_server.py +134 -0
- giga_sdk-0.7.1/giga/cli/api/chat/__init__.py +24 -0
- giga_sdk-0.7.1/giga/cli/api/chat/client.py +120 -0
- giga_sdk-0.7.1/giga/cli/api/chat/errors.py +109 -0
- giga_sdk-0.7.1/giga/cli/api/chat/types.py +37 -0
- giga_sdk-0.7.1/giga/cli/api/client.py +133 -0
- giga_sdk-0.7.1/giga/cli/api/code_blocks_client.py +66 -0
- giga_sdk-0.7.1/giga/cli/api/email_client.py +123 -0
- giga_sdk-0.7.1/giga/cli/api/error_mapper.py +186 -0
- giga_sdk-0.7.1/giga/cli/api/exceptions.py +34 -0
- giga_sdk-0.7.1/giga/cli/api/experiments_client.py +124 -0
- giga_sdk-0.7.1/giga/cli/api/fields_client.py +118 -0
- giga_sdk-0.7.1/giga/cli/api/git_sync_client.py +66 -0
- giga_sdk-0.7.1/giga/cli/api/kb_client.py +254 -0
- giga_sdk-0.7.1/giga/cli/api/kpi_improvement_items/__init__.py +31 -0
- giga_sdk-0.7.1/giga/cli/api/kpi_improvement_items/client.py +457 -0
- giga_sdk-0.7.1/giga/cli/api/kpi_improvement_items/types.py +275 -0
- giga_sdk-0.7.1/giga/cli/api/kpi_improvement_runs/__init__.py +0 -0
- giga_sdk-0.7.1/giga/cli/api/kpi_improvement_runs/client.py +58 -0
- giga_sdk-0.7.1/giga/cli/api/kpi_improvement_runs/types.py +75 -0
- giga_sdk-0.7.1/giga/cli/api/kpi_mining_client.py +21 -0
- giga_sdk-0.7.1/giga/cli/api/kpis/__init__.py +25 -0
- giga_sdk-0.7.1/giga/cli/api/kpis/client.py +333 -0
- giga_sdk-0.7.1/giga/cli/api/kpis/types.py +127 -0
- giga_sdk-0.7.1/giga/cli/api/mcp_client.py +92 -0
- giga_sdk-0.7.1/giga/cli/api/numbers_client.py +95 -0
- giga_sdk-0.7.1/giga/cli/api/oauth.py +157 -0
- giga_sdk-0.7.1/giga/cli/api/prefixes.py +61 -0
- giga_sdk-0.7.1/giga/cli/api/scout/__init__.py +33 -0
- giga_sdk-0.7.1/giga/cli/api/scout/client.py +191 -0
- giga_sdk-0.7.1/giga/cli/api/scout/errors.py +93 -0
- giga_sdk-0.7.1/giga/cli/api/scout/types.py +131 -0
- giga_sdk-0.7.1/giga/cli/api/secrets_client.py +55 -0
- giga_sdk-0.7.1/giga/cli/api/shared_code_templates/__init__.py +15 -0
- giga_sdk-0.7.1/giga/cli/api/shared_code_templates/client.py +48 -0
- giga_sdk-0.7.1/giga/cli/api/shared_code_templates/types.py +46 -0
- giga_sdk-0.7.1/giga/cli/api/tags/__init__.py +17 -0
- giga_sdk-0.7.1/giga/cli/api/tags/client.py +168 -0
- giga_sdk-0.7.1/giga/cli/api/tags/types.py +67 -0
- giga_sdk-0.7.1/giga/cli/api/tests_client.py +266 -0
- giga_sdk-0.7.1/giga/cli/api/ticket_sets/__init__.py +6 -0
- giga_sdk-0.7.1/giga/cli/api/ticket_sets/client.py +73 -0
- giga_sdk-0.7.1/giga/cli/api/ticket_sets/types.py +22 -0
- giga_sdk-0.7.1/giga/cli/api/tickets/__init__.py +35 -0
- giga_sdk-0.7.1/giga/cli/api/tickets/client.py +265 -0
- giga_sdk-0.7.1/giga/cli/api/tickets/types.py +305 -0
- giga_sdk-0.7.1/giga/cli/api/validators.py +25 -0
- giga_sdk-0.7.1/giga/cli/api/voices_client.py +57 -0
- giga_sdk-0.7.1/giga/cli/api/webhooks/__init__.py +21 -0
- giga_sdk-0.7.1/giga/cli/api/webhooks/client.py +127 -0
- giga_sdk-0.7.1/giga/cli/api/webhooks/types.py +81 -0
- giga_sdk-0.7.1/giga/cli/api/workspace_context.py +117 -0
- giga_sdk-0.7.1/giga/cli/api/workspaces_client.py +28 -0
- giga_sdk-0.7.1/giga/cli/commands/__init__.py +5 -0
- giga_sdk-0.7.1/giga/cli/commands/agents.py +463 -0
- giga_sdk-0.7.1/giga/cli/commands/chat/__init__.py +5 -0
- giga_sdk-0.7.1/giga/cli/commands/chat/cmd.py +520 -0
- giga_sdk-0.7.1/giga/cli/commands/chat/helpers.py +50 -0
- giga_sdk-0.7.1/giga/cli/commands/code.py +675 -0
- giga_sdk-0.7.1/giga/cli/commands/create_agent.py +426 -0
- giga_sdk-0.7.1/giga/cli/commands/email.py +444 -0
- giga_sdk-0.7.1/giga/cli/commands/experiments.py +441 -0
- giga_sdk-0.7.1/giga/cli/commands/fields.py +1657 -0
- giga_sdk-0.7.1/giga/cli/commands/git_sync.py +363 -0
- giga_sdk-0.7.1/giga/cli/commands/kb.py +556 -0
- giga_sdk-0.7.1/giga/cli/commands/kpi_improvement_items/__init__.py +15 -0
- giga_sdk-0.7.1/giga/cli/commands/kpi_improvement_items/cmd.py +273 -0
- giga_sdk-0.7.1/giga/cli/commands/kpi_improvement_items/comments.py +248 -0
- giga_sdk-0.7.1/giga/cli/commands/kpi_improvement_items/helpers.py +718 -0
- giga_sdk-0.7.1/giga/cli/commands/kpi_improvement_items/mutations.py +704 -0
- giga_sdk-0.7.1/giga/cli/commands/kpi_improvement_items/relations.py +150 -0
- giga_sdk-0.7.1/giga/cli/commands/kpi_improvement_runs.py +157 -0
- giga_sdk-0.7.1/giga/cli/commands/kpis/__init__.py +18 -0
- giga_sdk-0.7.1/giga/cli/commands/kpis/cmd.py +1002 -0
- giga_sdk-0.7.1/giga/cli/commands/kpis/helpers.py +183 -0
- giga_sdk-0.7.1/giga/cli/commands/kpis/mine.py +448 -0
- giga_sdk-0.7.1/giga/cli/commands/kpis/mutations.py +677 -0
- giga_sdk-0.7.1/giga/cli/commands/login.py +97 -0
- giga_sdk-0.7.1/giga/cli/commands/logout.py +37 -0
- giga_sdk-0.7.1/giga/cli/commands/mcp.py +142 -0
- giga_sdk-0.7.1/giga/cli/commands/numbers.py +586 -0
- giga_sdk-0.7.1/giga/cli/commands/scout/__init__.py +5 -0
- giga_sdk-0.7.1/giga/cli/commands/scout/cmd.py +264 -0
- giga_sdk-0.7.1/giga/cli/commands/scout/helpers.py +672 -0
- giga_sdk-0.7.1/giga/cli/commands/secrets.py +207 -0
- giga_sdk-0.7.1/giga/cli/commands/taxonomy/__init__.py +12 -0
- giga_sdk-0.7.1/giga/cli/commands/taxonomy/helpers.py +303 -0
- giga_sdk-0.7.1/giga/cli/commands/taxonomy/intents.py +309 -0
- giga_sdk-0.7.1/giga/cli/commands/taxonomy/tags.py +303 -0
- giga_sdk-0.7.1/giga/cli/commands/tests.py +643 -0
- giga_sdk-0.7.1/giga/cli/commands/tickets/__init__.py +8 -0
- giga_sdk-0.7.1/giga/cli/commands/tickets/cmd.py +620 -0
- giga_sdk-0.7.1/giga/cli/commands/tickets/download_helpers.py +363 -0
- giga_sdk-0.7.1/giga/cli/commands/tickets/helpers.py +677 -0
- giga_sdk-0.7.1/giga/cli/commands/tickets/sets.py +405 -0
- giga_sdk-0.7.1/giga/cli/commands/utils.py +128 -0
- giga_sdk-0.7.1/giga/cli/commands/validate.py +112 -0
- giga_sdk-0.7.1/giga/cli/commands/validate_formatter.py +112 -0
- giga_sdk-0.7.1/giga/cli/commands/voices.py +255 -0
- giga_sdk-0.7.1/giga/cli/commands/webhooks.py +438 -0
- giga_sdk-0.7.1/giga/cli/commands/whoami.py +23 -0
- giga_sdk-0.7.1/giga/cli/commands/yaml_validator.py +122 -0
- giga_sdk-0.7.1/giga/cli/config.py +234 -0
- giga_sdk-0.7.1/giga/cli/constants.py +4 -0
- giga_sdk-0.7.1/giga/cli/credentials.py +241 -0
- giga_sdk-0.7.1/giga/cli/githooks/__init__.py +5 -0
- giga_sdk-0.7.1/giga/cli/githooks/hook_scripts.py +15 -0
- giga_sdk-0.7.1/giga/cli/time_format.py +92 -0
- giga_sdk-0.7.1/giga/cli/types.py +16 -0
- giga_sdk-0.7.1/giga/code_block.py +256 -0
- giga_sdk-0.7.1/giga/context.py +42 -0
- giga_sdk-0.7.1/giga/py.typed +0 -0
- giga_sdk-0.7.1/giga/schema_utils.py +197 -0
- giga_sdk-0.7.1/giga/types.py +320 -0
- giga_sdk-0.7.1/giga/validation.py +56 -0
- giga_sdk-0.7.1/pyproject.toml +123 -0
- giga_sdk-0.7.1/tests/agent/test_register_mcp_server.py +61 -0
- giga_sdk-0.7.1/tests/agent/test_use.py +41 -0
- giga_sdk-0.7.1/tests/cli/_improvement_items_common.py +446 -0
- giga_sdk-0.7.1/tests/cli/conftest.py +85 -0
- giga_sdk-0.7.1/tests/cli/test_agents.py +554 -0
- giga_sdk-0.7.1/tests/cli/test_analytics_jobs_client.py +174 -0
- giga_sdk-0.7.1/tests/cli/test_app.py +65 -0
- giga_sdk-0.7.1/tests/cli/test_auth.py +663 -0
- giga_sdk-0.7.1/tests/cli/test_base_client.py +62 -0
- giga_sdk-0.7.1/tests/cli/test_callback_server.py +21 -0
- giga_sdk-0.7.1/tests/cli/test_chat.py +1013 -0
- giga_sdk-0.7.1/tests/cli/test_code.py +1089 -0
- giga_sdk-0.7.1/tests/cli/test_code_blocks_client.py +240 -0
- giga_sdk-0.7.1/tests/cli/test_config.py +147 -0
- giga_sdk-0.7.1/tests/cli/test_create_agent.py +210 -0
- giga_sdk-0.7.1/tests/cli/test_credentials.py +297 -0
- giga_sdk-0.7.1/tests/cli/test_custom_fields_backfill_client.py +363 -0
- giga_sdk-0.7.1/tests/cli/test_email.py +416 -0
- giga_sdk-0.7.1/tests/cli/test_error_mapper.py +110 -0
- giga_sdk-0.7.1/tests/cli/test_experiments.py +420 -0
- giga_sdk-0.7.1/tests/cli/test_fields.py +1379 -0
- giga_sdk-0.7.1/tests/cli/test_git_sync.py +410 -0
- giga_sdk-0.7.1/tests/cli/test_intents.py +412 -0
- giga_sdk-0.7.1/tests/cli/test_kb.py +845 -0
- giga_sdk-0.7.1/tests/cli/test_kb_client.py +184 -0
- giga_sdk-0.7.1/tests/cli/test_kpi_improvement_items.py +1762 -0
- giga_sdk-0.7.1/tests/cli/test_kpi_improvement_items_client.py +1059 -0
- giga_sdk-0.7.1/tests/cli/test_kpi_improvement_items_comments.py +470 -0
- giga_sdk-0.7.1/tests/cli/test_kpi_improvement_items_relations.py +281 -0
- giga_sdk-0.7.1/tests/cli/test_kpi_improvement_runs_client.py +142 -0
- giga_sdk-0.7.1/tests/cli/test_kpis.py +2110 -0
- giga_sdk-0.7.1/tests/cli/test_kpis_client.py +1025 -0
- giga_sdk-0.7.1/tests/cli/test_kpis_derivation.py +454 -0
- giga_sdk-0.7.1/tests/cli/test_kpis_mine.py +504 -0
- giga_sdk-0.7.1/tests/cli/test_local_agent_snapshot.py +219 -0
- giga_sdk-0.7.1/tests/cli/test_local_module_loader.py +48 -0
- giga_sdk-0.7.1/tests/cli/test_local_shared_code.py +158 -0
- giga_sdk-0.7.1/tests/cli/test_login.py +64 -0
- giga_sdk-0.7.1/tests/cli/test_logout.py +71 -0
- giga_sdk-0.7.1/tests/cli/test_mcp.py +290 -0
- giga_sdk-0.7.1/tests/cli/test_numbers.py +317 -0
- giga_sdk-0.7.1/tests/cli/test_oauth.py +128 -0
- giga_sdk-0.7.1/tests/cli/test_pre_push_hook.py +83 -0
- giga_sdk-0.7.1/tests/cli/test_pre_push_hook.sh +36 -0
- giga_sdk-0.7.1/tests/cli/test_scout.py +1230 -0
- giga_sdk-0.7.1/tests/cli/test_secrets.py +140 -0
- giga_sdk-0.7.1/tests/cli/test_shared_code_templates_client.py +230 -0
- giga_sdk-0.7.1/tests/cli/test_tags.py +356 -0
- giga_sdk-0.7.1/tests/cli/test_tags_client.py +357 -0
- giga_sdk-0.7.1/tests/cli/test_tests.py +631 -0
- giga_sdk-0.7.1/tests/cli/test_ticket_sets.py +621 -0
- giga_sdk-0.7.1/tests/cli/test_ticket_sets_client.py +195 -0
- giga_sdk-0.7.1/tests/cli/test_tickets.py +1421 -0
- giga_sdk-0.7.1/tests/cli/test_tickets_client.py +327 -0
- giga_sdk-0.7.1/tests/cli/test_tickets_download.py +578 -0
- giga_sdk-0.7.1/tests/cli/test_tickets_download_helpers.py +186 -0
- giga_sdk-0.7.1/tests/cli/test_validate.py +335 -0
- giga_sdk-0.7.1/tests/cli/test_validate_formatter.py +247 -0
- giga_sdk-0.7.1/tests/cli/test_voices.py +212 -0
- giga_sdk-0.7.1/tests/cli/test_webhooks.py +1043 -0
- giga_sdk-0.7.1/tests/cli/test_webhooks_client.py +935 -0
- giga_sdk-0.7.1/tests/cli/test_whoami.py +46 -0
- giga_sdk-0.7.1/tests/cli/test_workspace_scoped_clients.py +579 -0
- giga_sdk-0.7.1/tests/cli/test_yaml_validator.py +289 -0
- giga_sdk-0.7.1/tests/conftest.py +1 -0
- giga_sdk-0.7.1/tests/pytest_main.py +24 -0
- giga_sdk-0.7.1/tests/test_ast_utils.py +144 -0
- giga_sdk-0.7.1/tests/test_code_block.py +29 -0
- giga_sdk-0.7.1/tests/test_schema_utils.py +234 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Publish giga-sdk to PyPI
|
|
2
|
+
|
|
3
|
+
# Runs in the Giga-customers/giga-sdk mirror repo (this file is synced there by
|
|
4
|
+
# trillions' publish-giga-sdk.yml). A version bump in giga/__about__.py pushes a
|
|
5
|
+
# matching `v*` tag to the mirror, which triggers this workflow.
|
|
6
|
+
#
|
|
7
|
+
# Publishing is tokenless via PyPI Trusted Publishing (OIDC). The registered
|
|
8
|
+
# publisher on pypi.org must match: owner Giga-customers, repo giga-sdk,
|
|
9
|
+
# workflow pypi-release.yml, environment pypi.
|
|
10
|
+
#
|
|
11
|
+
# Targets real PyPI (pypi.org). To dry-run against TestPyPI instead, set
|
|
12
|
+
# `environment: testpypi` and add `repository-url: https://test.pypi.org/legacy/`
|
|
13
|
+
# to the publish step, and register the matching publisher on test.pypi.org.
|
|
14
|
+
|
|
15
|
+
on:
|
|
16
|
+
workflow_dispatch:
|
|
17
|
+
push:
|
|
18
|
+
tags:
|
|
19
|
+
- "v*"
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
publish:
|
|
23
|
+
name: Build and publish
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
environment: pypi
|
|
26
|
+
permissions:
|
|
27
|
+
id-token: write # required for Trusted Publishing (OIDC); no secrets used
|
|
28
|
+
contents: read
|
|
29
|
+
steps:
|
|
30
|
+
- name: Checkout
|
|
31
|
+
uses: actions/checkout@v6
|
|
32
|
+
|
|
33
|
+
- name: Install uv
|
|
34
|
+
uses: astral-sh/setup-uv@v6
|
|
35
|
+
|
|
36
|
+
- name: Build sdist + wheel
|
|
37
|
+
run: uv build
|
|
38
|
+
|
|
39
|
+
- name: Publish
|
|
40
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
giga_sdk-0.7.1/PKG-INFO
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: giga-sdk
|
|
3
|
+
Version: 0.7.1
|
|
4
|
+
Summary: Giga SDK and CLI — agent building framework with command-line tools
|
|
5
|
+
Project-URL: Homepage, https://giga.ai
|
|
6
|
+
Project-URL: Documentation, https://docs.giga.ai
|
|
7
|
+
Project-URL: Repository, https://github.com/Giga-customers/giga-sdk
|
|
8
|
+
Author-email: Giga Team <support@gigaml.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
Keywords: agents,ai,cli,framework,llm
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Python: >=3.12
|
|
18
|
+
Requires-Dist: click<9,>=8.0
|
|
19
|
+
Requires-Dist: httpx>=0.27.0
|
|
20
|
+
Requires-Dist: keyring>=25.0
|
|
21
|
+
Requires-Dist: packaging>=21.0
|
|
22
|
+
Requires-Dist: phonenumbers<9,>=8.13
|
|
23
|
+
Requires-Dist: pydantic>=2.0
|
|
24
|
+
Requires-Dist: pyyaml>=6.0
|
|
25
|
+
Requires-Dist: rich>=13.0
|
|
26
|
+
Requires-Dist: typer<0.26,>=0.12.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest-mock; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# Giga SDK
|
|
34
|
+
|
|
35
|
+
Agent building framework and CLI for the Giga platform.
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install giga-sdk
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Requirements
|
|
44
|
+
|
|
45
|
+
- Python >= 3.12
|
|
46
|
+
|
|
47
|
+
## CLI
|
|
48
|
+
|
|
49
|
+
After installation, the `giga` CLI is available:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
giga --help
|
|
53
|
+
giga login
|
|
54
|
+
giga validate
|
|
55
|
+
giga whoami
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## SDK
|
|
59
|
+
|
|
60
|
+
Create an agent, give it a typed variable store, and register hooks and code blocks
|
|
61
|
+
with decorators:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from pydantic import BaseModel
|
|
65
|
+
from giga import Agent, CodeBlockResult
|
|
66
|
+
|
|
67
|
+
class Variables(BaseModel):
|
|
68
|
+
guest_name: str | None = None
|
|
69
|
+
|
|
70
|
+
agent = Agent(name="my-agent", store=Variables)
|
|
71
|
+
|
|
72
|
+
@agent.initialization
|
|
73
|
+
def init(initialization_values, store):
|
|
74
|
+
return {"guest_name": "Unknown"}
|
|
75
|
+
|
|
76
|
+
@agent.code_block(description="Greet the user")
|
|
77
|
+
def greet(name: str, store) -> CodeBlockResult:
|
|
78
|
+
return CodeBlockResult(
|
|
79
|
+
message=f"Hello {name}!",
|
|
80
|
+
store_updates={"guest_name": name},
|
|
81
|
+
)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
You can also define API actions and post-conversation hooks:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from giga import api
|
|
88
|
+
from giga.types import ResolutionResult, Analysis
|
|
89
|
+
|
|
90
|
+
get_user = api(
|
|
91
|
+
name="get_user",
|
|
92
|
+
description="Get user info",
|
|
93
|
+
method="GET",
|
|
94
|
+
url="https://api.example.com/users/{id}",
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
@agent.post_conversation
|
|
98
|
+
def post_conversation(resolution_result: ResolutionResult, analysis: Analysis):
|
|
99
|
+
if resolution_result.resolution_status == "resolved":
|
|
100
|
+
print(f"Resolved: {analysis.summary}")
|
|
101
|
+
```
|
giga_sdk-0.7.1/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Giga SDK
|
|
2
|
+
|
|
3
|
+
Agent building framework and CLI for the Giga platform.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install giga-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
- Python >= 3.12
|
|
14
|
+
|
|
15
|
+
## CLI
|
|
16
|
+
|
|
17
|
+
After installation, the `giga` CLI is available:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
giga --help
|
|
21
|
+
giga login
|
|
22
|
+
giga validate
|
|
23
|
+
giga whoami
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## SDK
|
|
27
|
+
|
|
28
|
+
Create an agent, give it a typed variable store, and register hooks and code blocks
|
|
29
|
+
with decorators:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from pydantic import BaseModel
|
|
33
|
+
from giga import Agent, CodeBlockResult
|
|
34
|
+
|
|
35
|
+
class Variables(BaseModel):
|
|
36
|
+
guest_name: str | None = None
|
|
37
|
+
|
|
38
|
+
agent = Agent(name="my-agent", store=Variables)
|
|
39
|
+
|
|
40
|
+
@agent.initialization
|
|
41
|
+
def init(initialization_values, store):
|
|
42
|
+
return {"guest_name": "Unknown"}
|
|
43
|
+
|
|
44
|
+
@agent.code_block(description="Greet the user")
|
|
45
|
+
def greet(name: str, store) -> CodeBlockResult:
|
|
46
|
+
return CodeBlockResult(
|
|
47
|
+
message=f"Hello {name}!",
|
|
48
|
+
store_updates={"guest_name": name},
|
|
49
|
+
)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
You can also define API actions and post-conversation hooks:
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from giga import api
|
|
56
|
+
from giga.types import ResolutionResult, Analysis
|
|
57
|
+
|
|
58
|
+
get_user = api(
|
|
59
|
+
name="get_user",
|
|
60
|
+
description="Get user info",
|
|
61
|
+
method="GET",
|
|
62
|
+
url="https://api.example.com/users/{id}",
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
@agent.post_conversation
|
|
66
|
+
def post_conversation(resolution_result: ResolutionResult, analysis: Analysis):
|
|
67
|
+
if resolution_result.resolution_status == "resolved":
|
|
68
|
+
print(f"Resolved: {analysis.summary}")
|
|
69
|
+
```
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Giga SDK - Agent building framework for git-based configuration.
|
|
3
|
+
|
|
4
|
+
This SDK is bundled with exported agent repositories and provides:
|
|
5
|
+
- Agent class with decorators for hooks and code blocks
|
|
6
|
+
- Context for accessing variable store during execution
|
|
7
|
+
- CodeBlockResult for returning results from code blocks
|
|
8
|
+
- api() function for defining API actions
|
|
9
|
+
- Type definitions for hook parameters (ResolutionResult, Analysis, Event, etc.)
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
from giga import Agent, Context, CodeBlockResult, api
|
|
13
|
+
from giga.types import ResolutionResult, Analysis, Event, CallData
|
|
14
|
+
|
|
15
|
+
class Variables(BaseModel):
|
|
16
|
+
guest_name: str = None
|
|
17
|
+
|
|
18
|
+
agent = Agent(name="my-agent", store=Variables)
|
|
19
|
+
|
|
20
|
+
@agent.initialization
|
|
21
|
+
def init(initialization_values, store):
|
|
22
|
+
return {"guest_name": "Unknown"}
|
|
23
|
+
|
|
24
|
+
@agent.post_conversation
|
|
25
|
+
def post_conversation(
|
|
26
|
+
resolution_result: ResolutionResult,
|
|
27
|
+
analysis: Analysis,
|
|
28
|
+
tags: list[str],
|
|
29
|
+
custom_fields: list,
|
|
30
|
+
call_data: CallData,
|
|
31
|
+
events: list[Event],
|
|
32
|
+
):
|
|
33
|
+
# The final variable store snapshot lives on the most recent message
|
|
34
|
+
# that carries one — scan from the end (the last message can be a
|
|
35
|
+
# tool response or system event without a snapshot). Use
|
|
36
|
+
# ``is not None`` so an empty-dict snapshot still counts as the
|
|
37
|
+
# latest state instead of being skipped for a stale earlier one.
|
|
38
|
+
final_store = next(
|
|
39
|
+
(
|
|
40
|
+
m["variable_store"]
|
|
41
|
+
for m in reversed(call_data.get("messages") or [])
|
|
42
|
+
if m.get("variable_store") is not None
|
|
43
|
+
),
|
|
44
|
+
{},
|
|
45
|
+
)
|
|
46
|
+
guest_name = final_store.get("guest_name")
|
|
47
|
+
# Access typed parameters with intellisense
|
|
48
|
+
if resolution_result.resolution_status == "resolved":
|
|
49
|
+
print(f"Resolved: {analysis.summary}")
|
|
50
|
+
|
|
51
|
+
@agent.code_block(description="Greet the user")
|
|
52
|
+
def greet(name: str, store) -> CodeBlockResult:
|
|
53
|
+
return CodeBlockResult(
|
|
54
|
+
message=f"Hello {name}!",
|
|
55
|
+
store_updates={"guest_name": name}
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Define API actions
|
|
59
|
+
get_user = api(
|
|
60
|
+
name="get_user",
|
|
61
|
+
description="Get user info",
|
|
62
|
+
method="GET",
|
|
63
|
+
url="https://api.example.com/users/{id}"
|
|
64
|
+
)
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
from .agent import Agent
|
|
68
|
+
from .api import ApiAction, api
|
|
69
|
+
from .code_block import CodeBlockResult, code_block
|
|
70
|
+
from .context import Context
|
|
71
|
+
from .types import (
|
|
72
|
+
Analysis,
|
|
73
|
+
CallData,
|
|
74
|
+
CustomFields,
|
|
75
|
+
CustomFieldType,
|
|
76
|
+
CustomFieldValue,
|
|
77
|
+
Event,
|
|
78
|
+
Events,
|
|
79
|
+
EventType,
|
|
80
|
+
# Logger
|
|
81
|
+
Logger,
|
|
82
|
+
Message,
|
|
83
|
+
# Models
|
|
84
|
+
ResolutionResult,
|
|
85
|
+
ResolutionStatus,
|
|
86
|
+
# Enums
|
|
87
|
+
Sentiment,
|
|
88
|
+
# Type aliases
|
|
89
|
+
Tags,
|
|
90
|
+
logger,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
__all__ = [
|
|
94
|
+
"Agent",
|
|
95
|
+
"Analysis",
|
|
96
|
+
"ApiAction",
|
|
97
|
+
"CallData",
|
|
98
|
+
"CodeBlockResult",
|
|
99
|
+
"Context",
|
|
100
|
+
"CustomFieldType",
|
|
101
|
+
"CustomFieldValue",
|
|
102
|
+
"CustomFields",
|
|
103
|
+
"Event",
|
|
104
|
+
"EventType",
|
|
105
|
+
"Events",
|
|
106
|
+
"Logger",
|
|
107
|
+
"Message",
|
|
108
|
+
"ResolutionResult",
|
|
109
|
+
"ResolutionStatus",
|
|
110
|
+
"Sentiment",
|
|
111
|
+
"Tags",
|
|
112
|
+
"api",
|
|
113
|
+
"code_block",
|
|
114
|
+
"logger",
|
|
115
|
+
]
|
|
116
|
+
|
|
117
|
+
from giga.__about__ import VERSION as __version__
|