agent-starter-pack 0.3.3__py3-none-any.whl → 0.21.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.
- agent_starter_pack/agents/README.md +7 -0
- agents/langgraph_base_react/template/.templateconfig.yaml → agent_starter_pack/agents/adk_a2a_base/.template/templateconfig.yaml +5 -10
- agent_starter_pack/agents/adk_a2a_base/README.md +37 -0
- src/deployment_targets/cloud_run/Dockerfile → agent_starter_pack/agents/adk_a2a_base/app/__init__.py +2 -14
- agent_starter_pack/agents/adk_a2a_base/app/agent.py +70 -0
- agent_starter_pack/agents/adk_a2a_base/notebooks/adk_a2a_app_testing.ipynb +583 -0
- agents/crewai_coding_crew/notebooks/evaluating_crewai_agent.ipynb → agent_starter_pack/agents/adk_a2a_base/notebooks/evaluating_adk_agent.ipynb +163 -199
- {agents/adk_base → agent_starter_pack/agents/adk_a2a_base}/tests/integration/test_agent.py +2 -2
- agents/adk_base/template/.templateconfig.yaml → agent_starter_pack/agents/adk_base/.template/templateconfig.yaml +4 -1
- {agents → agent_starter_pack/agents}/adk_base/README.md +1 -1
- agent_starter_pack/agents/adk_base/app/__init__.py +17 -0
- {agents → agent_starter_pack/agents}/adk_base/app/agent.py +5 -2
- {agents → agent_starter_pack/agents}/adk_base/notebooks/adk_app_testing.ipynb +128 -82
- agents/langgraph_base_react/notebooks/evaluating_langgraph_agent.ipynb → agent_starter_pack/agents/adk_base/notebooks/evaluating_adk_agent.ipynb +181 -207
- agent_starter_pack/agents/adk_base/tests/integration/test_agent.py +58 -0
- agents/crewai_coding_crew/template/.templateconfig.yaml → agent_starter_pack/agents/adk_live/.template/templateconfig.yaml +5 -9
- agent_starter_pack/agents/adk_live/README.md +32 -0
- agent_starter_pack/agents/adk_live/app/__init__.py +17 -0
- agent_starter_pack/agents/adk_live/app/agent.py +51 -0
- agent_starter_pack/agents/adk_live/tests/unit/test_dummy.py +38 -0
- agents/agentic_rag/template/.templateconfig.yaml → agent_starter_pack/agents/agentic_rag/.template/templateconfig.yaml +7 -3
- {agents → agent_starter_pack/agents}/agentic_rag/README.md +1 -1
- agent_starter_pack/agents/agentic_rag/app/__init__.py +17 -0
- {agents → agent_starter_pack/agents}/agentic_rag/app/agent.py +8 -4
- {agents → agent_starter_pack/agents}/agentic_rag/notebooks/adk_app_testing.ipynb +128 -82
- agent_starter_pack/agents/agentic_rag/notebooks/evaluating_adk_agent.ipynb +1535 -0
- {agents → agent_starter_pack/agents}/agentic_rag/tests/integration/test_agent.py +3 -3
- agent_starter_pack/agents/langgraph_base/.template/templateconfig.yaml +31 -0
- agent_starter_pack/agents/langgraph_base/README.md +30 -0
- agent_starter_pack/agents/langgraph_base/app/__init__.py +17 -0
- agent_starter_pack/agents/langgraph_base/app/agent.py +34 -0
- {agents/crewai_coding_crew → agent_starter_pack/agents/langgraph_base}/notebooks/evaluating_langgraph_agent.ipynb +30 -17
- {agents/langgraph_base_react → agent_starter_pack/agents/langgraph_base}/tests/integration/test_agent.py +2 -2
- {src → agent_starter_pack}/base_template/.gitignore +5 -3
- agent_starter_pack/base_template/GEMINI.md +5 -0
- agent_starter_pack/base_template/Makefile +339 -0
- agent_starter_pack/base_template/README.md +267 -0
- agent_starter_pack/base_template/deployment/README.md +11 -0
- {src → agent_starter_pack}/base_template/deployment/terraform/apis.tf +2 -2
- {src → agent_starter_pack}/base_template/deployment/terraform/dev/apis.tf +6 -1
- {src → agent_starter_pack}/base_template/deployment/terraform/dev/iam.tf +12 -11
- {src → agent_starter_pack}/base_template/deployment/terraform/dev/providers.tf +5 -1
- {src → agent_starter_pack}/base_template/deployment/terraform/dev/storage.tf +1 -1
- {src → agent_starter_pack}/base_template/deployment/terraform/dev/variables.tf +10 -10
- agent_starter_pack/base_template/deployment/terraform/dev/{% if cookiecutter.is_adk %}telemetry.tf{% else %}unused_telemetry.tf{% endif %} +193 -0
- agent_starter_pack/base_template/deployment/terraform/github.tf +337 -0
- {src → agent_starter_pack}/base_template/deployment/terraform/iam.tf +20 -41
- {src → agent_starter_pack}/base_template/deployment/terraform/locals.tf +10 -3
- {src/resources/setup_cicd → agent_starter_pack/base_template/deployment/terraform}/providers.tf +8 -1
- {src → agent_starter_pack}/base_template/deployment/terraform/service_accounts.tf +7 -8
- agent_starter_pack/base_template/deployment/terraform/sql/completions.sql +138 -0
- {src → agent_starter_pack}/base_template/deployment/terraform/storage.tf +7 -16
- {src → agent_starter_pack}/base_template/deployment/terraform/variables.tf +61 -28
- {src → agent_starter_pack}/base_template/deployment/terraform/vars/env.tfvars +6 -1
- agent_starter_pack/base_template/deployment/terraform/{% if cookiecutter.cicd_runner == 'github_actions' %}wif.tf{% else %}unused_wif.tf{% endif %} +43 -0
- src/base_template/deployment/terraform/build_triggers.tf → agent_starter_pack/base_template/deployment/terraform/{% if cookiecutter.cicd_runner == 'google_cloud_build' %}build_triggers.tf{% else %}unused_build_triggers.tf{% endif %} +55 -38
- agent_starter_pack/base_template/deployment/terraform/{% if cookiecutter.is_adk %}telemetry.tf{% else %}unused_telemetry.tf{% endif %} +206 -0
- {src → agent_starter_pack}/base_template/pyproject.toml +24 -37
- agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'github_actions' %}.github{% else %}unused_github{% endif %}/workflows/deploy-to-prod.yaml +132 -0
- agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'github_actions' %}.github{% else %}unused_github{% endif %}/workflows/pr_checks.yaml +65 -0
- agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'github_actions' %}.github{% else %}unused_github{% endif %}/workflows/staging.yaml +259 -0
- src/base_template/deployment/cd/deploy-to-prod.yaml → agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'google_cloud_build' %}.cloudbuild{% else %}unused_.cloudbuild{% endif %}/deploy-to-prod.yaml +38 -30
- src/base_template/deployment/ci/pr_checks.yaml → agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'google_cloud_build' %}.cloudbuild{% else %}unused_.cloudbuild{% endif %}/pr_checks.yaml +5 -5
- agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'google_cloud_build' %}.cloudbuild{% else %}unused_.cloudbuild{% endif %}/staging.yaml +322 -0
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/telemetry.py +96 -0
- {src/base_template/app/utils → agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils}/typing.py +7 -9
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}converters{% else %}unused_converters{% endif %}/__init__.py +25 -0
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}converters{% else %}unused_converters{% endif %}/part_converter.py +138 -0
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}executor{% else %}unused_executor{% endif %}/__init__.py +13 -0
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}executor{% else %}unused_executor{% endif %}/a2a_agent_executor.py +265 -0
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}executor{% else %}unused_executor{% endif %}/task_result_aggregator.py +152 -0
- agent_starter_pack/cli/commands/create.py +1256 -0
- agent_starter_pack/cli/commands/enhance.py +611 -0
- agent_starter_pack/cli/commands/list.py +203 -0
- agent_starter_pack/cli/commands/register_gemini_enterprise.py +1070 -0
- agent_starter_pack/cli/commands/setup_cicd.py +862 -0
- {src → agent_starter_pack}/cli/main.py +10 -2
- {src → agent_starter_pack}/cli/utils/cicd.py +139 -48
- agent_starter_pack/cli/utils/gcp.py +263 -0
- agent_starter_pack/cli/utils/logging.py +103 -0
- agent_starter_pack/cli/utils/remote_template.py +677 -0
- agent_starter_pack/cli/utils/template.py +1466 -0
- {src → agent_starter_pack}/data_ingestion/data_ingestion_pipeline/components/process_data.py +1 -1
- {src → agent_starter_pack}/data_ingestion/data_ingestion_pipeline/submit_pipeline.py +20 -6
- {src → agent_starter_pack}/data_ingestion/pyproject.toml +1 -0
- {src → agent_starter_pack}/data_ingestion/uv.lock +602 -494
- agent_starter_pack/deployment_targets/agent_engine/tests/integration/test_agent_engine_app.py +484 -0
- agent_starter_pack/deployment_targets/agent_engine/tests/load_test/README.md +84 -0
- agent_starter_pack/deployment_targets/agent_engine/tests/load_test/load_test.py +424 -0
- agent_starter_pack/deployment_targets/agent_engine/tests/{% if cookiecutter.is_a2a %}helpers.py{% else %}unused_helpers.py{% endif %} +138 -0
- agent_starter_pack/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/agent_engine_app.py +263 -0
- agent_starter_pack/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/app_utils/deploy.py +414 -0
- agent_starter_pack/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_adk_live %}expose_app.py{% else %}unused_expose_app.py{% endif %} +519 -0
- agent_starter_pack/deployment_targets/cloud_run/Dockerfile +51 -0
- agent_starter_pack/deployment_targets/cloud_run/deployment/terraform/dev/service.tf +243 -0
- agent_starter_pack/deployment_targets/cloud_run/deployment/terraform/service.tf +417 -0
- agent_starter_pack/deployment_targets/cloud_run/tests/integration/test_server_e2e.py +705 -0
- agent_starter_pack/deployment_targets/cloud_run/tests/load_test/.results/.placeholder +321 -0
- agent_starter_pack/deployment_targets/cloud_run/tests/load_test/README.md +165 -0
- agent_starter_pack/deployment_targets/cloud_run/tests/load_test/load_test.py +329 -0
- agent_starter_pack/deployment_targets/cloud_run/{{cookiecutter.agent_directory}}/fast_api_app.py +556 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/package-lock.json +79 -1044
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/package.json +1 -9
- agent_starter_pack/frontends/adk_live_react/frontend/src/App.tsx +65 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/logger/Logger.tsx +8 -3
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/logger/logger.scss +26 -0
- agent_starter_pack/frontends/adk_live_react/frontend/src/components/side-panel/SidePanel.tsx +516 -0
- agent_starter_pack/frontends/adk_live_react/frontend/src/components/side-panel/side-panel.scss +563 -0
- agent_starter_pack/frontends/adk_live_react/frontend/src/components/transcription-preview/TranscriptionPreview.tsx +106 -0
- agent_starter_pack/frontends/adk_live_react/frontend/src/components/transcription-preview/transcription-preview.scss +150 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/hooks/use-live-api.ts +8 -2
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/multimodal-live-types.ts +40 -2
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/audio-recorder.ts +1 -1
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/audio-streamer.ts +1 -1
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/multimodal-live-client.ts +210 -24
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/utils.ts +27 -5
- agent_starter_pack/resources/docs/adk-cheatsheet.md +1628 -0
- agent_starter_pack/resources/locks/uv-adk_a2a_base-agent_engine.lock +4966 -0
- agent_starter_pack/resources/locks/uv-adk_a2a_base-cloud_run.lock +5011 -0
- agent_starter_pack/resources/locks/uv-adk_base-agent_engine.lock +4946 -0
- agent_starter_pack/resources/locks/uv-adk_base-cloud_run.lock +4991 -0
- agent_starter_pack/resources/locks/uv-adk_live-agent_engine.lock +4963 -0
- agent_starter_pack/resources/locks/uv-adk_live-cloud_run.lock +5006 -0
- agent_starter_pack/resources/locks/uv-agentic_rag-agent_engine.lock +5487 -0
- agent_starter_pack/resources/locks/uv-agentic_rag-cloud_run.lock +5532 -0
- agent_starter_pack/resources/locks/uv-langgraph_base-agent_engine.lock +5788 -0
- agent_starter_pack/resources/locks/uv-langgraph_base-cloud_run.lock +5811 -0
- {src → agent_starter_pack}/utils/generate_locks.py +15 -12
- {src → agent_starter_pack}/utils/lock_utils.py +4 -7
- {src → agent_starter_pack}/utils/watch_and_rebuild.py +2 -2
- agent_starter_pack-0.21.0.dist-info/METADATA +182 -0
- agent_starter_pack-0.21.0.dist-info/RECORD +171 -0
- agent_starter_pack-0.21.0.dist-info/entry_points.txt +2 -0
- llm.txt +362 -0
- agent_starter_pack-0.3.3.dist-info/METADATA +0 -164
- agent_starter_pack-0.3.3.dist-info/RECORD +0 -176
- agent_starter_pack-0.3.3.dist-info/entry_points.txt +0 -2
- agents/crewai_coding_crew/README.md +0 -34
- agents/crewai_coding_crew/app/agent.py +0 -86
- agents/crewai_coding_crew/app/crew/config/agents.yaml +0 -39
- agents/crewai_coding_crew/app/crew/config/tasks.yaml +0 -37
- agents/crewai_coding_crew/app/crew/crew.py +0 -71
- agents/crewai_coding_crew/tests/integration/test_agent.py +0 -47
- agents/langgraph_base_react/README.md +0 -9
- agents/langgraph_base_react/app/agent.py +0 -73
- agents/live_api/README.md +0 -37
- agents/live_api/app/agent.py +0 -78
- agents/live_api/app/server.py +0 -196
- agents/live_api/app/templates.py +0 -51
- agents/live_api/app/vector_store.py +0 -55
- agents/live_api/template/.templateconfig.yaml +0 -29
- agents/live_api/tests/integration/test_server_e2e.py +0 -254
- agents/live_api/tests/load_test/load_test.py +0 -40
- agents/live_api/tests/unit/test_server.py +0 -143
- src/base_template/Makefile +0 -72
- src/base_template/README.md +0 -208
- src/base_template/app/__init__.py +0 -3
- src/base_template/app/utils/tracing.py +0 -155
- src/base_template/deployment/README.md +0 -126
- src/base_template/deployment/cd/staging.yaml +0 -216
- src/base_template/deployment/terraform/dev/log_sinks.tf +0 -63
- src/base_template/deployment/terraform/log_sinks.tf +0 -70
- src/base_template/deployment/terraform/providers.tf +0 -37
- src/cli/commands/create.py +0 -664
- src/cli/commands/setup_cicd.py +0 -829
- src/cli/utils/gcp.py +0 -117
- src/cli/utils/logging.py +0 -51
- src/cli/utils/template.py +0 -737
- src/deployment_targets/agent_engine/app/agent_engine_app.py +0 -336
- src/deployment_targets/agent_engine/notebooks/intro_agent_engine.ipynb +0 -1025
- src/deployment_targets/agent_engine/tests/integration/test_agent_engine_app.py +0 -183
- src/deployment_targets/agent_engine/tests/load_test/README.md +0 -42
- src/deployment_targets/agent_engine/tests/load_test/load_test.py +0 -107
- src/deployment_targets/cloud_run/app/server.py +0 -154
- src/deployment_targets/cloud_run/tests/integration/test_server_e2e.py +0 -249
- src/deployment_targets/cloud_run/tests/load_test/.results/.placeholder +0 -0
- src/deployment_targets/cloud_run/tests/load_test/README.md +0 -83
- src/deployment_targets/cloud_run/tests/load_test/load_test.py +0 -118
- src/deployment_targets/cloud_run/uv.lock +0 -6952
- src/frontends/live_api_react/frontend/src/App.tsx +0 -205
- src/frontends/live_api_react/frontend/src/components/control-tray/ControlTray.tsx +0 -217
- src/frontends/live_api_react/frontend/src/components/control-tray/control-tray.scss +0 -201
- src/frontends/live_api_react/frontend/src/components/side-panel/SidePanel.tsx +0 -161
- src/frontends/live_api_react/frontend/src/components/side-panel/side-panel.scss +0 -285
- src/frontends/streamlit/frontend/side_bar.py +0 -214
- src/frontends/streamlit/frontend/streamlit_app.py +0 -265
- src/frontends/streamlit/frontend/style/app_markdown.py +0 -37
- src/frontends/streamlit/frontend/utils/chat_utils.py +0 -67
- src/frontends/streamlit/frontend/utils/local_chat_history.py +0 -125
- src/frontends/streamlit/frontend/utils/message_editing.py +0 -59
- src/frontends/streamlit/frontend/utils/multimodal_utils.py +0 -217
- src/frontends/streamlit/frontend/utils/stream_handler.py +0 -301
- src/frontends/streamlit/frontend/utils/title_summary.py +0 -94
- src/frontends/streamlit_adk/frontend/side_bar.py +0 -214
- src/frontends/streamlit_adk/frontend/streamlit_app.py +0 -314
- src/frontends/streamlit_adk/frontend/style/app_markdown.py +0 -37
- src/frontends/streamlit_adk/frontend/utils/chat_utils.py +0 -84
- src/frontends/streamlit_adk/frontend/utils/local_chat_history.py +0 -110
- src/frontends/streamlit_adk/frontend/utils/message_editing.py +0 -61
- src/frontends/streamlit_adk/frontend/utils/multimodal_utils.py +0 -223
- src/frontends/streamlit_adk/frontend/utils/stream_handler.py +0 -311
- src/frontends/streamlit_adk/frontend/utils/title_summary.py +0 -129
- src/resources/containers/data_processing/Dockerfile +0 -27
- src/resources/containers/e2e-tests/Dockerfile +0 -19
- src/resources/idx/.idx/dev.nix +0 -57
- src/resources/idx/idx-template.json +0 -21
- src/resources/idx/idx-template.nix +0 -26
- src/resources/locks/uv-adk_base-agent_engine.lock +0 -5338
- src/resources/locks/uv-adk_base-cloud_run.lock +0 -5930
- src/resources/locks/uv-agentic_rag-agent_engine.lock +0 -5528
- src/resources/locks/uv-agentic_rag-cloud_run.lock +0 -6120
- src/resources/locks/uv-crewai_coding_crew-agent_engine.lock +0 -6231
- src/resources/locks/uv-crewai_coding_crew-cloud_run.lock +0 -6839
- src/resources/locks/uv-langgraph_base_react-agent_engine.lock +0 -5233
- src/resources/locks/uv-langgraph_base_react-cloud_run.lock +0 -5862
- src/resources/locks/uv-live_api-cloud_run.lock +0 -5832
- src/resources/setup_cicd/cicd_variables.tf +0 -41
- src/resources/setup_cicd/github.tf +0 -87
- {agents → agent_starter_pack/agents}/agentic_rag/app/retrievers.py +0 -0
- {agents → agent_starter_pack/agents}/agentic_rag/app/templates.py +0 -0
- {src → agent_starter_pack}/base_template/deployment/terraform/dev/vars/env.tfvars +0 -0
- {src → agent_starter_pack}/base_template/tests/unit/test_dummy.py +0 -0
- {src/deployment_targets/agent_engine/app/utils → agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils}/gcs.py +0 -0
- {src → agent_starter_pack}/cli/utils/__init__.py +0 -0
- {src → agent_starter_pack}/cli/utils/datastores.py +0 -0
- {src → agent_starter_pack}/cli/utils/version.py +0 -0
- {src → agent_starter_pack}/data_ingestion/README.md +0 -0
- {src → agent_starter_pack}/data_ingestion/data_ingestion_pipeline/components/ingest_data.py +0 -0
- {src → agent_starter_pack}/data_ingestion/data_ingestion_pipeline/pipeline.py +0 -0
- {src → agent_starter_pack}/deployment_targets/agent_engine/deployment_metadata.json +0 -0
- {src → agent_starter_pack}/deployment_targets/agent_engine/tests/load_test/.results/.placeholder +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/public/favicon.ico +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/public/index.html +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/public/robots.txt +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/App.scss +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/App.test.tsx +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/audio-pulse/AudioPulse.tsx +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/audio-pulse/audio-pulse.scss +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/logger/mock-logs.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/contexts/LiveAPIContext.tsx +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/hooks/use-media-stream-mux.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/hooks/use-screen-capture.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/hooks/use-webcam.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/index.css +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/index.tsx +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/react-app-env.d.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/reportWebVitals.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/setupTests.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/audioworklet-registry.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/store-logger.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/worklets/audio-processing.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/worklets/vol-meter.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/tsconfig.json +0 -0
- {agent_starter_pack-0.3.3.dist-info → agent_starter_pack-0.21.0.dist-info}/WHEEL +0 -0
- {agent_starter_pack-0.3.3.dist-info → agent_starter_pack-0.21.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
# Copyright 2025 Google LLC
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
|
-
import logging
|
|
16
|
-
|
|
17
|
-
import pytest
|
|
18
|
-
{%- if "adk" in cookiecutter.tags %}
|
|
19
|
-
from google.adk.events.event import Event
|
|
20
|
-
|
|
21
|
-
from app.agent import root_agent
|
|
22
|
-
from app.agent_engine_app import AgentEngineApp
|
|
23
|
-
{%- else %}
|
|
24
|
-
|
|
25
|
-
from app.agent_engine_app import AgentEngineApp
|
|
26
|
-
{%- endif %}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
@pytest.fixture
|
|
30
|
-
def agent_app() -> AgentEngineApp:
|
|
31
|
-
"""Fixture to create and set up AgentEngineApp instance"""
|
|
32
|
-
{%- if "adk" in cookiecutter.tags %}
|
|
33
|
-
app = AgentEngineApp(agent=root_agent)
|
|
34
|
-
{%- else %}
|
|
35
|
-
app = AgentEngineApp()
|
|
36
|
-
{%- endif %}
|
|
37
|
-
app.set_up()
|
|
38
|
-
return app
|
|
39
|
-
|
|
40
|
-
{% if "adk" in cookiecutter.tags %}
|
|
41
|
-
def test_agent_stream_query(agent_app: AgentEngineApp) -> None:
|
|
42
|
-
"""
|
|
43
|
-
Integration test for the agent stream query functionality.
|
|
44
|
-
Tests that the agent returns valid streaming responses.
|
|
45
|
-
"""
|
|
46
|
-
# Create message and events for the stream_query
|
|
47
|
-
message = "What's the weather in San Francisco?"
|
|
48
|
-
events = list(agent_app.stream_query(message=message, user_id="test"))
|
|
49
|
-
assert len(events) > 0, "Expected at least one chunk in response"
|
|
50
|
-
|
|
51
|
-
# Check for valid content in the response
|
|
52
|
-
has_text_content = False
|
|
53
|
-
for event in events:
|
|
54
|
-
validated_event = Event.model_validate(event)
|
|
55
|
-
content = validated_event.content
|
|
56
|
-
if (
|
|
57
|
-
content is not None
|
|
58
|
-
and content.parts
|
|
59
|
-
and any(part.text for part in content.parts)
|
|
60
|
-
):
|
|
61
|
-
has_text_content = True
|
|
62
|
-
break
|
|
63
|
-
|
|
64
|
-
assert has_text_content, "Expected at least one event with text content"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def test_agent_feedback(agent_app: AgentEngineApp) -> None:
|
|
68
|
-
"""
|
|
69
|
-
Integration test for the agent feedback functionality.
|
|
70
|
-
Tests that feedback can be registered successfully.
|
|
71
|
-
"""
|
|
72
|
-
feedback_data = {
|
|
73
|
-
"score": 5,
|
|
74
|
-
"text": "Great response!",
|
|
75
|
-
"invocation_id": "test-run-123",
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
# Should not raise any exceptions
|
|
79
|
-
agent_app.register_feedback(feedback_data)
|
|
80
|
-
|
|
81
|
-
# Test invalid feedback
|
|
82
|
-
with pytest.raises(ValueError):
|
|
83
|
-
invalid_feedback = {
|
|
84
|
-
"score": "invalid", # Score must be numeric
|
|
85
|
-
"text": "Bad feedback",
|
|
86
|
-
"invocation_id": "test-run-123",
|
|
87
|
-
}
|
|
88
|
-
agent_app.register_feedback(invalid_feedback)
|
|
89
|
-
|
|
90
|
-
logging.info("All assertions passed for agent feedback test")
|
|
91
|
-
{% else %}
|
|
92
|
-
def test_agent_stream_query(agent_app: AgentEngineApp) -> None:
|
|
93
|
-
"""
|
|
94
|
-
Integration test for the agent stream query functionality.
|
|
95
|
-
Tests that the agent returns valid streaming responses.
|
|
96
|
-
"""
|
|
97
|
-
input_dict = {
|
|
98
|
-
"messages": [
|
|
99
|
-
{"type": "human", "content": "Test message"},
|
|
100
|
-
],
|
|
101
|
-
"user_id": "test-user",
|
|
102
|
-
"session_id": "test-session",
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
events = list(agent_app.stream_query(input=input_dict))
|
|
106
|
-
|
|
107
|
-
assert len(events) > 0, "Expected at least one chunk in response"
|
|
108
|
-
|
|
109
|
-
# Verify each event is a tuple of message and metadata
|
|
110
|
-
for event in events:
|
|
111
|
-
assert isinstance(event, list), "Event should be a list"
|
|
112
|
-
assert len(event) == 2, "Event should contain message and metadata"
|
|
113
|
-
message, _ = event
|
|
114
|
-
|
|
115
|
-
# Verify message structure
|
|
116
|
-
assert isinstance(message, dict), "Message should be a dictionary"
|
|
117
|
-
assert message["type"] == "constructor"
|
|
118
|
-
assert "kwargs" in message, "Constructor message should have kwargs"
|
|
119
|
-
|
|
120
|
-
# Verify at least one message has content
|
|
121
|
-
has_content = False
|
|
122
|
-
for event in events:
|
|
123
|
-
message = event[0]
|
|
124
|
-
if message.get("type") == "constructor" and "content" in message["kwargs"]:
|
|
125
|
-
has_content = True
|
|
126
|
-
break
|
|
127
|
-
assert has_content, "At least one message should have content"
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
def test_agent_query(agent_app: AgentEngineApp) -> None:
|
|
131
|
-
"""
|
|
132
|
-
Integration test for the agent query functionality.
|
|
133
|
-
Tests that the agent returns valid responses.
|
|
134
|
-
"""
|
|
135
|
-
input_dict = {
|
|
136
|
-
"messages": [
|
|
137
|
-
{"type": "human", "content": "Test message"},
|
|
138
|
-
],
|
|
139
|
-
"user_id": "test-user",
|
|
140
|
-
"session_id": "test-session",
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
response = agent_app.query(input=input_dict)
|
|
144
|
-
|
|
145
|
-
# Basic response validation
|
|
146
|
-
assert isinstance(response, dict), "Response should be a dictionary"
|
|
147
|
-
assert "messages" in response, "Response should contain messages"
|
|
148
|
-
assert len(response["messages"]) > 0, "Response should have at least one message"
|
|
149
|
-
|
|
150
|
-
# Validate last message is AI response with content
|
|
151
|
-
message = response["messages"][-1]
|
|
152
|
-
kwargs = message["kwargs"]
|
|
153
|
-
assert kwargs["type"] == "ai", "Last message should be AI response"
|
|
154
|
-
assert len(kwargs["content"]) > 0, "AI message content should not be empty"
|
|
155
|
-
|
|
156
|
-
logging.info("All assertions passed for agent query test")
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
def test_agent_feedback(agent_app: AgentEngineApp) -> None:
|
|
160
|
-
"""
|
|
161
|
-
Integration test for the agent feedback functionality.
|
|
162
|
-
Tests that feedback can be registered successfully.
|
|
163
|
-
"""
|
|
164
|
-
feedback_data = {
|
|
165
|
-
"score": 5,
|
|
166
|
-
"text": "Great response!",
|
|
167
|
-
"run_id": "test-run-123",
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
# Should not raise any exceptions
|
|
171
|
-
agent_app.register_feedback(feedback_data)
|
|
172
|
-
|
|
173
|
-
# Test invalid feedback
|
|
174
|
-
with pytest.raises(ValueError):
|
|
175
|
-
invalid_feedback = {
|
|
176
|
-
"score": "invalid", # Score must be numeric
|
|
177
|
-
"text": "Bad feedback",
|
|
178
|
-
"run_id": "test-run-123",
|
|
179
|
-
}
|
|
180
|
-
agent_app.register_feedback(invalid_feedback)
|
|
181
|
-
|
|
182
|
-
logging.info("All assertions passed for agent feedback test")
|
|
183
|
-
{% endif %}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# Robust Load Testing for Generative AI Applications
|
|
2
|
-
|
|
3
|
-
This directory provides a comprehensive load testing framework for your Generative AI application, leveraging the power of [Locust](http://locust.io), a leading open-source load testing tool.
|
|
4
|
-
|
|
5
|
-
## Load Testing
|
|
6
|
-
|
|
7
|
-
Before running load tests, ensure you have deployed the backend remotely.
|
|
8
|
-
|
|
9
|
-
Follow these steps to execute load tests:
|
|
10
|
-
|
|
11
|
-
**1. Deploy the Backend Remotely:**
|
|
12
|
-
```bash
|
|
13
|
-
gcloud config set project <your-dev-project-id>
|
|
14
|
-
make backend
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
**2. Create a Virtual Environment for Locust:**
|
|
18
|
-
It's recommended to use a separate terminal tab and create a virtual environment for Locust to avoid conflicts with your application's Python environment.
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
# Create and activate virtual environment
|
|
22
|
-
python3 -m venv locust_env
|
|
23
|
-
source locust_env/bin/activate
|
|
24
|
-
|
|
25
|
-
# Install required packages
|
|
26
|
-
pip install locust==2.31.1 "google-cloud-aiplatform[langchain,reasoningengine]>=1.77.0"
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**3. Execute the Load Test:**
|
|
30
|
-
Trigger the Locust load test with the following command:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
export _AUTH_TOKEN=$(gcloud auth print-access-token -q)
|
|
34
|
-
locust -f tests/load_test/load_test.py \
|
|
35
|
-
--headless \
|
|
36
|
-
-t 30s -u 5 -r 2 \
|
|
37
|
-
--csv=tests/load_test/.results/results \
|
|
38
|
-
--html=tests/load_test/.results/report.html
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
This command initiates a 30-second load test, simulating 2 users spawning per second, reaching a maximum of 10 concurrent users.
|
|
42
|
-
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
# Copyright 2025 Google LLC
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
|
-
import json
|
|
16
|
-
import logging
|
|
17
|
-
import os
|
|
18
|
-
import time
|
|
19
|
-
|
|
20
|
-
from locust import HttpUser, between, task
|
|
21
|
-
|
|
22
|
-
# Configure logging
|
|
23
|
-
logging.basicConfig(
|
|
24
|
-
level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
|
25
|
-
)
|
|
26
|
-
logger = logging.getLogger(__name__)
|
|
27
|
-
|
|
28
|
-
# Initialize Vertex AI and load agent config
|
|
29
|
-
with open("deployment_metadata.json") as f:
|
|
30
|
-
remote_agent_engine_id = json.load(f)["remote_agent_engine_id"]
|
|
31
|
-
|
|
32
|
-
parts = remote_agent_engine_id.split("/")
|
|
33
|
-
project_id = parts[1]
|
|
34
|
-
location = parts[3]
|
|
35
|
-
engine_id = parts[5]
|
|
36
|
-
|
|
37
|
-
# Convert remote agent engine ID to streaming URL.
|
|
38
|
-
base_url = f"https://{location}-aiplatform.googleapis.com"
|
|
39
|
-
url_path = f"/v1beta1/projects/{project_id}/locations/{location}/reasoningEngines/{engine_id}:streamQuery"
|
|
40
|
-
|
|
41
|
-
logger.info("Using remote agent engine ID: %s", remote_agent_engine_id)
|
|
42
|
-
logger.info("Using base URL: %s", base_url)
|
|
43
|
-
logger.info("Using URL path: %s", url_path)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class ChatStreamUser(HttpUser):
|
|
47
|
-
"""Simulates a user interacting with the chat stream API."""
|
|
48
|
-
|
|
49
|
-
wait_time = between(1, 3) # Wait 1-3 seconds between tasks
|
|
50
|
-
host = base_url # Set the base host URL for Locust
|
|
51
|
-
|
|
52
|
-
@task
|
|
53
|
-
def chat_stream(self) -> None:
|
|
54
|
-
"""Simulates a chat stream interaction."""
|
|
55
|
-
headers = {"Content-Type": "application/json"}
|
|
56
|
-
headers["Authorization"] = f"Bearer {os.environ['_AUTH_TOKEN']}"
|
|
57
|
-
{% if "adk" in cookiecutter.tags %}
|
|
58
|
-
data = {
|
|
59
|
-
"input": {
|
|
60
|
-
"message": "What's the weather in San Francisco?",
|
|
61
|
-
"user_id": "test",
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
{% else %}
|
|
65
|
-
data = {
|
|
66
|
-
"input": {
|
|
67
|
-
"input": {
|
|
68
|
-
"messages": [
|
|
69
|
-
{"type": "human", "content": "Hello, AI!"},
|
|
70
|
-
{"type": "ai", "content": "Hello!"},
|
|
71
|
-
{"type": "human", "content": "How are you?"},
|
|
72
|
-
]
|
|
73
|
-
},
|
|
74
|
-
"config": {
|
|
75
|
-
"metadata": {"user_id": "test-user", "session_id": "test-session"}
|
|
76
|
-
},
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
{% endif %}
|
|
80
|
-
start_time = time.time()
|
|
81
|
-
with self.client.post(
|
|
82
|
-
url_path,
|
|
83
|
-
headers=headers,
|
|
84
|
-
json=data,
|
|
85
|
-
catch_response=True,
|
|
86
|
-
name="/stream_messages first message",
|
|
87
|
-
stream=True,
|
|
88
|
-
params={"alt": "sse"},
|
|
89
|
-
) as response:
|
|
90
|
-
if response.status_code == 200:
|
|
91
|
-
events = []
|
|
92
|
-
for line in response.iter_lines():
|
|
93
|
-
if line:
|
|
94
|
-
event = json.loads(line)
|
|
95
|
-
events.append(event)
|
|
96
|
-
end_time = time.time()
|
|
97
|
-
total_time = end_time - start_time
|
|
98
|
-
self.environment.events.request.fire(
|
|
99
|
-
request_type="POST",
|
|
100
|
-
name="/stream_messages end",
|
|
101
|
-
response_time=total_time * 1000, # Convert to milliseconds
|
|
102
|
-
response_length=len(json.dumps(events)),
|
|
103
|
-
response=response,
|
|
104
|
-
context={},
|
|
105
|
-
)
|
|
106
|
-
else:
|
|
107
|
-
response.failure(f"Unexpected status code: {response.status_code}")
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
# Copyright 2025 Google LLC
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
{% if "adk" in cookiecutter.tags %}
|
|
15
|
-
import os
|
|
16
|
-
|
|
17
|
-
from fastapi import FastAPI
|
|
18
|
-
from google.adk.cli.fast_api import get_fast_api_app
|
|
19
|
-
from google.cloud import logging as google_cloud_logging
|
|
20
|
-
from opentelemetry import trace
|
|
21
|
-
from opentelemetry.sdk.trace import TracerProvider, export
|
|
22
|
-
|
|
23
|
-
from app.utils.tracing import CloudTraceLoggingSpanExporter
|
|
24
|
-
from app.utils.typing import Feedback
|
|
25
|
-
|
|
26
|
-
logging_client = google_cloud_logging.Client()
|
|
27
|
-
logger = logging_client.logger(__name__)
|
|
28
|
-
|
|
29
|
-
provider = TracerProvider()
|
|
30
|
-
processor = export.BatchSpanProcessor(CloudTraceLoggingSpanExporter())
|
|
31
|
-
provider.add_span_processor(processor)
|
|
32
|
-
trace.set_tracer_provider(provider)
|
|
33
|
-
|
|
34
|
-
AGENT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
35
|
-
app: FastAPI = get_fast_api_app(agent_dir=AGENT_DIR, web=False)
|
|
36
|
-
|
|
37
|
-
app.title = "{{cookiecutter.project_name}}"
|
|
38
|
-
app.description = "API for interacting with the Agent {{cookiecutter.project_name}}"
|
|
39
|
-
{%- else %}
|
|
40
|
-
import logging
|
|
41
|
-
import os
|
|
42
|
-
from collections.abc import Generator
|
|
43
|
-
|
|
44
|
-
from fastapi import FastAPI
|
|
45
|
-
from fastapi.responses import RedirectResponse, StreamingResponse
|
|
46
|
-
from google.cloud import logging as google_cloud_logging
|
|
47
|
-
from langchain_core.runnables import RunnableConfig
|
|
48
|
-
from traceloop.sdk import Instruments, Traceloop
|
|
49
|
-
|
|
50
|
-
from app.agent import agent
|
|
51
|
-
from app.utils.tracing import CloudTraceLoggingSpanExporter
|
|
52
|
-
from app.utils.typing import Feedback, InputChat, Request, dumps, ensure_valid_config
|
|
53
|
-
|
|
54
|
-
# Initialize FastAPI app and logging
|
|
55
|
-
app = FastAPI(
|
|
56
|
-
title="{{cookiecutter.project_name}}",
|
|
57
|
-
description="API for interacting with the Agent {{cookiecutter.project_name}}",
|
|
58
|
-
)
|
|
59
|
-
logging_client = google_cloud_logging.Client()
|
|
60
|
-
logger = logging_client.logger(__name__)
|
|
61
|
-
|
|
62
|
-
# Initialize Telemetry
|
|
63
|
-
try:
|
|
64
|
-
Traceloop.init(
|
|
65
|
-
app_name=app.title,
|
|
66
|
-
disable_batch=False,
|
|
67
|
-
exporter=CloudTraceLoggingSpanExporter(),
|
|
68
|
-
instruments={Instruments.LANGCHAIN, Instruments.CREW},
|
|
69
|
-
)
|
|
70
|
-
except Exception as e:
|
|
71
|
-
logging.error("Failed to initialize Telemetry: %s", str(e))
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
def set_tracing_properties(config: RunnableConfig) -> None:
|
|
75
|
-
"""Sets tracing association properties for the current request.
|
|
76
|
-
|
|
77
|
-
Args:
|
|
78
|
-
config: Optional RunnableConfig containing request metadata
|
|
79
|
-
"""
|
|
80
|
-
Traceloop.set_association_properties(
|
|
81
|
-
{
|
|
82
|
-
"log_type": "tracing",
|
|
83
|
-
"run_id": str(config.get("run_id", "None")),
|
|
84
|
-
"user_id": config["metadata"].pop("user_id", "None"),
|
|
85
|
-
"session_id": config["metadata"].pop("session_id", "None"),
|
|
86
|
-
"commit_sha": os.environ.get("COMMIT_SHA", "None"),
|
|
87
|
-
}
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def stream_messages(
|
|
92
|
-
input: InputChat,
|
|
93
|
-
config: RunnableConfig | None = None,
|
|
94
|
-
) -> Generator[str, None, None]:
|
|
95
|
-
"""Stream events in response to an input chat.
|
|
96
|
-
|
|
97
|
-
Args:
|
|
98
|
-
input: The input chat messages
|
|
99
|
-
config: Optional configuration for the runnable
|
|
100
|
-
|
|
101
|
-
Yields:
|
|
102
|
-
JSON serialized event data
|
|
103
|
-
"""
|
|
104
|
-
config = ensure_valid_config(config=config)
|
|
105
|
-
set_tracing_properties(config)
|
|
106
|
-
input_dict = input.model_dump()
|
|
107
|
-
|
|
108
|
-
for data in agent.stream(input_dict, config=config, stream_mode="messages"):
|
|
109
|
-
yield dumps(data) + "\n"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
# Routes
|
|
113
|
-
@app.get("/", response_class=RedirectResponse)
|
|
114
|
-
def redirect_root_to_docs() -> RedirectResponse:
|
|
115
|
-
"""Redirect the root URL to the API documentation."""
|
|
116
|
-
return RedirectResponse(url="/docs")
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
@app.post("/stream_messages")
|
|
120
|
-
def stream_chat_events(request: Request) -> StreamingResponse:
|
|
121
|
-
"""Stream chat events in response to an input request.
|
|
122
|
-
|
|
123
|
-
Args:
|
|
124
|
-
request: The chat request containing input and config
|
|
125
|
-
|
|
126
|
-
Returns:
|
|
127
|
-
Streaming response of chat events
|
|
128
|
-
"""
|
|
129
|
-
return StreamingResponse(
|
|
130
|
-
stream_messages(input=request.input, config=request.config),
|
|
131
|
-
media_type="text/event-stream",
|
|
132
|
-
)
|
|
133
|
-
{%- endif %}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
@app.post("/feedback")
|
|
137
|
-
def collect_feedback(feedback: Feedback) -> dict[str, str]:
|
|
138
|
-
"""Collect and log feedback.
|
|
139
|
-
|
|
140
|
-
Args:
|
|
141
|
-
feedback: The feedback data to log
|
|
142
|
-
|
|
143
|
-
Returns:
|
|
144
|
-
Success message
|
|
145
|
-
"""
|
|
146
|
-
logger.log_struct(feedback.model_dump(), severity="INFO")
|
|
147
|
-
return {"status": "success"}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
# Main execution
|
|
151
|
-
if __name__ == "__main__":
|
|
152
|
-
import uvicorn
|
|
153
|
-
|
|
154
|
-
uvicorn.run(app, host="0.0.0.0", port=8000)
|