google-adk 0.0.2__py3-none-any.whl → 0.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. google/adk/._version.py +0 -0
  2. google/adk/cli/agent_graph.py +31 -5
  3. google/adk/cli/browser/index.html +1 -1
  4. google/adk/cli/browser/{main-XUU6OGCC.js → main-SY2WYYGV.js} +1 -1
  5. google/adk/cli/cli_tools_click.py +51 -6
  6. google/adk/cli/fast_api.py +19 -9
  7. google/adk/docs/Makefile +20 -0
  8. google/adk/docs/build/doctrees/google-adk.doctree +0 -0
  9. google/adk/docs/build/html/_sources/google-adk.rst.txt +98 -0
  10. google/adk/docs/build/html/_sources/index.rst.txt +7 -0
  11. google/adk/docs/build/html/_static/autodoc_pydantic.css +27 -0
  12. google/adk/docs/build/html/_static/basic.css +925 -0
  13. google/adk/docs/build/html/_static/debug.css +85 -0
  14. google/adk/docs/build/html/_static/doctools.js +156 -0
  15. google/adk/docs/build/html/_static/documentation_options.js +29 -0
  16. google/adk/docs/build/html/_static/file.png +0 -0
  17. google/adk/docs/build/html/_static/language_data.js +199 -0
  18. google/adk/docs/build/html/_static/minus.png +0 -0
  19. google/adk/docs/build/html/_static/plus.png +0 -0
  20. google/adk/docs/build/html/_static/pygments.css +274 -0
  21. google/adk/docs/build/html/_static/scripts/furo-extensions.js +16 -0
  22. google/adk/docs/build/html/_static/scripts/furo.js +19 -0
  23. google/adk/docs/build/html/_static/scripts/furo.js.LICENSE.txt +7 -0
  24. google/adk/docs/build/html/_static/scripts/furo.js.map +1 -0
  25. google/adk/docs/build/html/_static/searchtools.js +620 -0
  26. google/adk/docs/build/html/_static/skeleton.css +312 -0
  27. google/adk/docs/build/html/_static/sphinx_highlight.js +170 -0
  28. google/adk/docs/build/html/_static/styles/furo-extensions.css +18 -0
  29. google/adk/docs/build/html/_static/styles/furo-extensions.css.map +1 -0
  30. google/adk/docs/build/html/_static/styles/furo.css +18 -0
  31. google/adk/docs/build/html/_static/styles/furo.css.map +1 -0
  32. google/adk/docs/build/html/genindex.html +861 -0
  33. google/adk/docs/build/html/google-adk.html +5461 -0
  34. google/adk/docs/build/html/index.html +567 -0
  35. google/adk/docs/build/html/objects.inv +0 -0
  36. google/adk/docs/build/html/py-modindex.html +373 -0
  37. google/adk/docs/build/html/search.html +333 -0
  38. google/adk/docs/build/html/searchindex.js +17 -0
  39. google/adk/docs/source/conf.py +133 -0
  40. google/adk/docs/source/google-adk.rst +98 -0
  41. google/adk/docs/source/index.rst +7 -0
  42. google/adk/version.py +1 -1
  43. {google_adk-0.0.2.dist-info → google_adk-0.0.3.dist-info}/METADATA +1 -1
  44. {google_adk-0.0.2.dist-info → google_adk-0.0.3.dist-info}/RECORD +46 -14
  45. google/adk/cli/media_streamer/__init__.py +0 -19
  46. google/adk/cli/media_streamer/index.html +0 -228
  47. google/adk/tests/integration/fixture/flow_complex_spark/sample.debug.log +0 -243
  48. google_adk-0.0.2.dist-info/LICENSE +0 -202
  49. {google_adk-0.0.2.dist-info → google_adk-0.0.3.dist-info}/WHEEL +0 -0
  50. {google_adk-0.0.2.dist-info → google_adk-0.0.3.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,98 @@
1
+ Submodules
2
+ ----------
3
+
4
+ google.adk.agents module
5
+ ------------------------
6
+
7
+ .. automodule:: google.adk.agents
8
+ :members:
9
+ :undoc-members:
10
+ :show-inheritance:
11
+
12
+ google.adk.artifacts module
13
+ ---------------------------
14
+
15
+ .. automodule:: google.adk.artifacts
16
+ :members:
17
+ :undoc-members:
18
+ :show-inheritance:
19
+
20
+ google.adk.code_executors module
21
+ --------------------------------
22
+
23
+ .. automodule:: google.adk.code_executors
24
+ :members:
25
+ :undoc-members:
26
+ :show-inheritance:
27
+
28
+ google.adk.evaluation module
29
+ ----------------------------
30
+
31
+ .. automodule:: google.adk.evaluation
32
+ :members:
33
+ :undoc-members:
34
+ :show-inheritance:
35
+
36
+ google.adk.events module
37
+ ------------------------
38
+
39
+ .. automodule:: google.adk.events
40
+ :members:
41
+ :undoc-members:
42
+ :show-inheritance:
43
+
44
+ google.adk.examples module
45
+ --------------------------
46
+
47
+ .. automodule:: google.adk.examples
48
+ :members:
49
+ :undoc-members:
50
+ :show-inheritance:
51
+
52
+ google.adk.memory module
53
+ ------------------------
54
+
55
+ .. automodule:: google.adk.memory
56
+ :members:
57
+ :undoc-members:
58
+ :show-inheritance:
59
+
60
+ google.adk.models module
61
+ ------------------------
62
+
63
+ .. automodule:: google.adk.models
64
+ :members:
65
+ :undoc-members:
66
+ :show-inheritance:
67
+
68
+ google.adk.planners module
69
+ --------------------------
70
+
71
+ .. automodule:: google.adk.planners
72
+ :members:
73
+ :undoc-members:
74
+ :show-inheritance:
75
+
76
+ google.adk.runners module
77
+ --------------------------
78
+
79
+ .. automodule:: google.adk.runners
80
+ :members:
81
+ :undoc-members:
82
+ :show-inheritance:
83
+
84
+ google.adk.sessions module
85
+ --------------------------
86
+
87
+ .. automodule:: google.adk.sessions
88
+ :members:
89
+ :undoc-members:
90
+ :show-inheritance:
91
+
92
+ google.adk.tools module
93
+ -----------------------
94
+
95
+ .. automodule:: google.adk.tools
96
+ :members:
97
+ :undoc-members:
98
+ :show-inheritance:
@@ -0,0 +1,7 @@
1
+ google
2
+ ======
3
+
4
+ .. toctree::
5
+ :maxdepth: 4
6
+
7
+ google-adk
google/adk/version.py CHANGED
@@ -13,4 +13,4 @@
13
13
  # limitations under the License.
14
14
 
15
15
  # version: date+base_cl
16
- __version__ = "0.0.2"
16
+ __version__ = "0.0.3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: google-adk
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary:
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  Requires-Python: >=3.9
@@ -1,7 +1,8 @@
1
+ google/adk/._version.py,sha256=lcqb7-4m3YezIvAKlkvLhI7NHJZn08uQOGshVuPjf_8,4096
1
2
  google/adk/__init__.py,sha256=sSPQK3r0tW8ahl-k8SXkZvMcbiTbGICCtrw6KkFucyg,726
2
3
  google/adk/runners.py,sha256=Vzv6reiWCVVqH2r2d8E3DIX1y2Qdz7G-UjmTh0Vpenk,15116
3
4
  google/adk/telemetry.py,sha256=kxR9VxIMJKAwtTOS0lnq-rS-ZYTZt3pIegHvcV86z7w,6284
4
- google/adk/version.py,sha256=MDLpOAJZZpXpnNUKVPRIpnutCfpZ7Bha_iCDbceEGwA,621
5
+ google/adk/version.py,sha256=NPWfaEEyERhQo_AE2htS3ZSVpDL8Poy_pylOOZGkzLc,621
5
6
  google/adk/agents/__init__.py,sha256=WsCiBlvI-ISWrcntboo_sULvVJNwLNxXCe42UGPLKdY,1041
6
7
  google/adk/agents/active_streaming_tool.py,sha256=AYrT9aCFBzaESFzkMTil_fuK1zDoKDfZQaQXL3_Jxog,1159
7
8
  google/adk/agents/base_agent.py,sha256=wBiVLK11jBDB-bExFeNwoWnbw2dv_f3aYOKKGaSDnjU,10574
@@ -29,21 +30,19 @@ google/adk/auth/auth_schemes.py,sha256=dxx9bxjOWoae1fSVxbpaVTwa0I4v76_QJJFEX--1u
29
30
  google/adk/auth/auth_tool.py,sha256=yTljVLHsxyWIdTu4lKF71NU2Xhw57YAx2b0sBgRQ78U,2265
30
31
  google/adk/cli/__init__.py,sha256=ouPYnIY02VmGNfpA6IT8oSQdfeZd1LHVoDSt_x8zQPU,609
31
32
  google/adk/cli/__main__.py,sha256=gN8rRWlkh_3gLI-oYByxrKpCW9BIfDwrr0YuyisxmHo,646
32
- google/adk/cli/agent_graph.py,sha256=PSZyAjHwS65Sr4lk3ePDPmQfuqJlxUdO8hgrF-YI3xQ,4227
33
+ google/adk/cli/agent_graph.py,sha256=H5gvs2wG6ks3F6pk14f33txmvAN9rr0_2H2fNMF96VE,4754
33
34
  google/adk/cli/cli.py,sha256=jULA7eDAsJ_HDHKIpKLMmjg1cwzywEWSYpcKppwk6dM,5853
34
35
  google/adk/cli/cli_deploy.py,sha256=cTUnro45ZmpX95TexASfnch3L_7PIcomZQ4bKxz22f0,5044
35
36
  google/adk/cli/cli_eval.py,sha256=HCEpPEe89L2woswTeL3pML4R8fo4uJbAw7ThLg_gb3s,9218
36
- google/adk/cli/cli_tools_click.py,sha256=gl_qoDUd_6r4UsN2F9i2O9Narb1ZHEm73ktJNfQSYxQ,12659
37
- google/adk/cli/fast_api.py,sha256=HIdIWy4XHeV_uKDZEJxcn3iLYbNV36SQIy--GTXZV6A,25292
37
+ google/adk/cli/cli_tools_click.py,sha256=q3MBIQUzPAWmc684v6tHuI6SfV3Yd3ZTaCAOv-jLqKI,14108
38
+ google/adk/cli/fast_api.py,sha256=b171jDFYBYO4k_Lgbudgkd2fsVeK8TLNdYC-p8R0uEc,25684
38
39
  google/adk/cli/browser/adk_favicon.svg,sha256=giyzTZ5Xe6HFU63NgTIZDm35L-RmID-odVFOZ4vMo1M,3132
39
- google/adk/cli/browser/index.html,sha256=mN-yRDDiOUz8JgY5fP3tgL83m1Wkd9X8CafpP4lp-mg,18483
40
- google/adk/cli/browser/main-XUU6OGCC.js,sha256=19yZBK8qAa1pllG37Jedk4FrVOS-BM1tvHPvAe5VRwk,2438948
40
+ google/adk/cli/browser/index.html,sha256=l3v2yvptoJqltEjz0vHg_XVCIMd04kQ1Bfno8zL2E2A,18483
41
+ google/adk/cli/browser/main-SY2WYYGV.js,sha256=hBFP2ptwtvPVNKED7AyE3xCABq4Q2SoIs9MYQDxuIA8,2438978
41
42
  google/adk/cli/browser/polyfills-FFHMD2TL.js,sha256=6tcwOogi31Djphkq1hP2H5TxfN1MBg3P4YYrxHNdH5M,35115
42
43
  google/adk/cli/browser/styles-4VDSPQ37.css,sha256=QF3xmtXMt44nFiCh0aKnvQwQiZptr3sW1u9bzltukAI,5522
43
44
  google/adk/cli/browser/assets/audio-processor.js,sha256=BTYefpDeOz7VQveAoC_WFleLY9JkJs_FuGS0oQiadIA,1769
44
45
  google/adk/cli/browser/assets/config/runtime-config.json,sha256=obOpZdzA-utX_wG6I687-5W7i1f8W9ixXOb7ky7rdvU,22
45
- google/adk/cli/media_streamer/__init__.py,sha256=s23xhp-9z2kxBqbTz-qgj58pHTrUQk5eDlo-DmMbbHw,721
46
- google/adk/cli/media_streamer/index.html,sha256=7UNqft3qMY5QCcuG-nAWWAroFEvcOrA3SbTFz7XHKh4,8439
47
46
  google/adk/cli/utils/__init__.py,sha256=2PrkBZeLjc3mXZMDJkev3IKgd07d4CheASgTB3tqz8Y,1528
48
47
  google/adk/cli/utils/envs.py,sha256=dqNooABP_xaU35H9rqlMwESX4gsQJSdc4_cxXGM1Asw,1786
49
48
  google/adk/cli/utils/evals.py,sha256=02FOqE0m7aE7EgRStCyslXB5rNQ2sV1mZHvLf-xWR0E,3350
@@ -55,6 +54,41 @@ google/adk/code_executors/code_executor_context.py,sha256=W8kLnyDLq0Ci_8dDHXv9Cm
55
54
  google/adk/code_executors/container_code_executor.py,sha256=KW6ESSFcsh9WMmohOJIntV7cct2QRclNhBkYGiRwEy8,6418
56
55
  google/adk/code_executors/unsafe_local_code_executor.py,sha256=0UHcjaFF5V8swin3WLs6UjAaW7P_tPmSyaaPOOiDPys,2387
57
56
  google/adk/code_executors/vertex_ai_code_executor.py,sha256=CvPv0cZw-PjPxMFzf01e83bTSy_yksunub8r62hBOgg,7254
57
+ google/adk/docs/Makefile,sha256=4zv3TVkTACm6JBaKgTES3ZI9cETXgM6ULbZkXZP1as8,638
58
+ google/adk/docs/build/doctrees/google-adk.doctree,sha256=IBmsN8CsshO26hat38glW2E9qP-fkxkm8B4ffx3hYSw,736152
59
+ google/adk/docs/build/html/genindex.html,sha256=p6cjfYDQTNXTdg75Cbz3bSO5DQJ17iDR-wNbg6bRXfE,45434
60
+ google/adk/docs/build/html/google-adk.html,sha256=awf017q4EAlo7GTm41gZGC0cgoeHUuV1WRWddK2Uuek,613923
61
+ google/adk/docs/build/html/index.html,sha256=fIUn1yj0metQqqQDB2KTLehdKN6ArP8N6LfJqjDKkA4,55976
62
+ google/adk/docs/build/html/objects.inv,sha256=htqLk6TXi7LadOHDFGx0XadNGHy0KhkKny4qLIYv2AQ,1800
63
+ google/adk/docs/build/html/py-modindex.html,sha256=VbBq3745ppPSfGufCvJMyYm-FsTnH24c2zLz5fWiPvU,17763
64
+ google/adk/docs/build/html/search.html,sha256=ACXfhyTnIPtIZ2SeRPg_YyUEJ4yFJ9EPmsx40dba_OY,16298
65
+ google/adk/docs/build/html/searchindex.js,sha256=hBLo7KW3k0X6aNR6BRjX-TjO28zWdLmJK_Qg-hlnNyA,36417
66
+ google/adk/docs/build/html/_sources/google-adk.rst.txt,sha256=yQiNlZNGwAqku1JkycTRBiWMVDbV5_g22tliM03--Kc,1801
67
+ google/adk/docs/build/html/_sources/index.rst.txt,sha256=z9TpN-pt4XGKUlXepf1HAhGUlQut44hYrV_90hCJKYo,58
68
+ google/adk/docs/build/html/_static/autodoc_pydantic.css,sha256=G6gOQfUBUnmS1o7Fa2cplU02_L--PlbdNiiuEF0xQ8o,777
69
+ google/adk/docs/build/html/_static/basic.css,sha256=gLIkBTmzbTROfJqlCQmVp3P_rh3ZDyHMBD5gV9lUPD0,15094
70
+ google/adk/docs/build/html/_static/debug.css,sha256=niUmuYNKI0IMee56OKbOYYOFKI7Rd3_QG9jZyHDi_3w,1862
71
+ google/adk/docs/build/html/_static/doctools.js,sha256=gcsto8KE5CmhpjqyiiC34wvOuOsVVqFUyMusC0zneVs,4472
72
+ google/adk/docs/build/html/_static/documentation_options.js,sha256=KuSwj0ghcsQf3tG0xFI7s3_Ch7yT-43nj9-pHABxubc,919
73
+ google/adk/docs/build/html/_static/file.png,sha256=XEvJoWrr84xLlQ9ZuOUByjZJUyjLnrYiIYvOkGSjXj4,286
74
+ google/adk/docs/build/html/_static/language_data.js,sha256=26ix2NzhHa2zm9JNK6vbYXpX-PJ-BMYUJpyTe3hd8Ao,4758
75
+ google/adk/docs/build/html/_static/minus.png,sha256=R-f8UNs2mfHKQc6aL_ogLADF0dUYDFX2K6hZsb1swAg,90
76
+ google/adk/docs/build/html/_static/plus.png,sha256=VBFRmblqEwy6AhR8R8DetD3Mm58ItRYruoZCs0mArGM,90
77
+ google/adk/docs/build/html/_static/pygments.css,sha256=XrWRJdJPGAOMFFxt8_sGgwYzUTwwuRrGoWwWPNTWkOk,21906
78
+ google/adk/docs/build/html/_static/searchtools.js,sha256=irrDXfNjDCA_rVEOZvL54HJaeQgLi-lhEeI4oHFQCAU,20842
79
+ google/adk/docs/build/html/_static/skeleton.css,sha256=Y5M1fK46pHOR9IKayLYZa4m-LroXpDHYuYHN6Gy4nn8,6630
80
+ google/adk/docs/build/html/_static/sphinx_highlight.js,sha256=qfQeunAqz4wTkmmYlavJ9a23kMjvgfRHYwYiXJRzDPc,5719
81
+ google/adk/docs/build/html/_static/scripts/furo-extensions.js,sha256=cIdVo4fBGm0zahH9E6o07xV5Yw-RJ7SxtguODZMWEj8,596
82
+ google/adk/docs/build/html/_static/scripts/furo.js,sha256=aN8QZva2pPU7p7kSssPachgw4hrW6FlBZRwerKM1Fr0,5915
83
+ google/adk/docs/build/html/_static/scripts/furo.js.LICENSE.txt,sha256=PrpxjJir4K2N1EAe3J3fq_l5-bubisRGRgthsDaUlw0,187
84
+ google/adk/docs/build/html/_static/scripts/furo.js.map,sha256=P-fONwEE1ndGh_olHC2Q1UQsnpNIOEO0MxIxVLvSzDs,28762
85
+ google/adk/docs/build/html/_static/styles/furo-extensions.css,sha256=dg-jItgIKR1P_6jHpAj9PF_xwoOVKQHrT105Z276cFI,6115
86
+ google/adk/docs/build/html/_static/styles/furo-extensions.css.map,sha256=t7V4zp1SoywgXfGulz9o7-svZMBTUtd6FWRwx6iiolQ,7762
87
+ google/adk/docs/build/html/_static/styles/furo.css,sha256=Vu5oJahT7kBwxsWhXkvwdcSgQ907Lh_IqhNNG7_o8k8,51665
88
+ google/adk/docs/build/html/_static/styles/furo.css.map,sha256=juWOvGCdMP7rbAgUXSBAUobZas7Yp-J2B1tahMJ1LOg,76649
89
+ google/adk/docs/source/conf.py,sha256=1lnMQ-G31WVYgGAi8_suuu-sM6UhT_fdL48ZPFQlhd0,4477
90
+ google/adk/docs/source/google-adk.rst,sha256=yQiNlZNGwAqku1JkycTRBiWMVDbV5_g22tliM03--Kc,1801
91
+ google/adk/docs/source/index.rst,sha256=z9TpN-pt4XGKUlXepf1HAhGUlQut44hYrV_90hCJKYo,58
58
92
  google/adk/evaluation/__init__.py,sha256=h39Lgl_gUiF2OVyJi5nJMKZBgNwKpeo9Bt3YN4JdKng,1004
59
93
  google/adk/evaluation/agent_evaluator.py,sha256=PS8MobbBtrRB8t1biSe-2k7yHtyCooYvY9MeKKPdWjc,11490
60
94
  google/adk/evaluation/evaluation_constants.py,sha256=P5f9V-0JS9Hre1InJc4-aSHwI3Laedbp5huzEX1FnqI,856
@@ -142,7 +176,6 @@ google/adk/tests/integration/fixture/ecommerce_customer_service_agent/order_quer
142
176
  google/adk/tests/integration/fixture/ecommerce_customer_service_agent/test_config.json,sha256=HlmTz8aITbFVXYdCJn6ePDJMPtUGJcflpbzPlUmzk5E,94
143
177
  google/adk/tests/integration/fixture/flow_complex_spark/__init__.py,sha256=pfxqApXg-KBYArQmB8GF3e3oWAKONyuj8fQd2v0uIFA,595
144
178
  google/adk/tests/integration/fixture/flow_complex_spark/agent.py,sha256=ZZm9YBSlqHjKPqlrL9VskyPtRY_jFLtYcjsF-UMOpuI,6364
145
- google/adk/tests/integration/fixture/flow_complex_spark/sample.debug.log,sha256=5kf52vWzrA-yUmPTtJQNK98fLV-T9nnUBk3EIbxEPoQ,48259
146
179
  google/adk/tests/integration/fixture/flow_complex_spark/sample.session.json,sha256=RwwPtzZXJB6W22hTr4tYZrtRgesWP7mt-PVaClMJURw,20759
147
180
  google/adk/tests/integration/fixture/hello_world_agent/__init__.py,sha256=pfxqApXg-KBYArQmB8GF3e3oWAKONyuj8fQd2v0uIFA,595
148
181
  google/adk/tests/integration/fixture/hello_world_agent/agent.py,sha256=8gznrzO2hAYECTY8yIJPeFchkg-epMsY2d643TI1e8s,3758
@@ -301,8 +334,7 @@ google/adk/tools/retrieval/base_retrieval_tool.py,sha256=4aar8Kg-6rQG7Ht1n18D5fv
301
334
  google/adk/tools/retrieval/files_retrieval.py,sha256=bucma_LL7aw15GQnYwgpDP1Lo9UqN-RFlG3w1w0sWfw,1158
302
335
  google/adk/tools/retrieval/llama_index_retrieval.py,sha256=r9HUQXqygxizX0OXz7pJAWxzRRwmofAtFa3UvRR2di0,1304
303
336
  google/adk/tools/retrieval/vertex_ai_rag_retrieval.py,sha256=FzLpZctWX232wn24M-CvjV8s1StivNy8H7e5IqgWphg,3340
304
- google_adk-0.0.2.dist-info/entry_points.txt,sha256=zL9CU-6V2yQ2oc5lrcyj55ROHrpiIePsvQJ4H6SL-zI,43
305
- google_adk-0.0.2.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
306
- google_adk-0.0.2.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
307
- google_adk-0.0.2.dist-info/METADATA,sha256=rNvjyRIUa_ptpkXy27tygm8-QKwWD4mN212t1k4EZLs,3130
308
- google_adk-0.0.2.dist-info/RECORD,,
337
+ google_adk-0.0.3.dist-info/entry_points.txt,sha256=zL9CU-6V2yQ2oc5lrcyj55ROHrpiIePsvQJ4H6SL-zI,43
338
+ google_adk-0.0.3.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
339
+ google_adk-0.0.3.dist-info/METADATA,sha256=_BL9hYIi7iKhBqwAyQv1hO9EGEkN0Fvg4OEIo4__ei4,3130
340
+ google_adk-0.0.3.dist-info/RECORD,,
@@ -1,19 +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 streamlit.components.v1 as components
16
-
17
- media_streamer = components.declare_component(
18
- name='media_streamer', path='./media_streamer'
19
- )
@@ -1,228 +0,0 @@
1
- <!--
2
- Copyright 2025 Google LLC
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- -->
16
-
17
- <html>
18
- <head>
19
- <style type="text/css">
20
- body {
21
- font-family: sans-serif;
22
- padding: 10px;
23
- }
24
- button {
25
- font-size: 16px;
26
- padding: 10px 15px;
27
- margin-right: 10px;
28
- }
29
- #status {
30
- font-weight: bold;
31
- }
32
- /* Mirror the preview video */
33
- #videoPreview {
34
- border: 1px solid #ccc;
35
- transform: scaleX(-1);
36
- }
37
- </style>
38
- </head>
39
- <body>
40
- <h2>Audio &amp; Video Recorder Component</h2>
41
- <!-- Video preview -->
42
- <video id="videoPreview" autoplay muted playsinline width="320" height="240"></video>
43
- <br/>
44
- <!-- Unified start/stop buttons -->
45
- <button id="startButton" onclick="startRecording()">Start Streaming</button>
46
- <button id="stopButton" onclick="stopRecording()" disabled>Stop Streaming</button>
47
- <span id="status">Idle</span>
48
-
49
- <script type="text/javascript">
50
- // --- Streamlit component lifecycle constants ---
51
- const SET_COMPONENT_VALUE = "streamlit:setComponentValue";
52
- const COMPONENT_READY = "streamlit:componentReady";
53
- const SET_FRAME_HEIGHT = "streamlit:setFrameHeight";
54
- const RENDER = "streamlit:render";
55
-
56
- // Helper function to send messages to the Streamlit host.
57
- function _sendMessage(type, data) {
58
- const outboundData = Object.assign({ isStreamlitMessage: true, type: type }, data);
59
- window.parent.postMessage(outboundData, "*");
60
- }
61
- function setFrameHeight(height) {
62
- _sendMessage(SET_FRAME_HEIGHT, { height: height });
63
- }
64
- // This function sends the combined data.
65
- function notifyHost(data) {
66
- _sendMessage(SET_COMPONENT_VALUE, data);
67
- }
68
- function initialize() {
69
- _sendMessage(COMPONENT_READY, { apiVersion: 1 });
70
- window.addEventListener("load", function() {
71
- setTimeout(() => setFrameHeight(document.documentElement.clientHeight), 0);
72
- });
73
- }
74
- initialize();
75
-
76
- // --- Global Variables ---
77
- let isRecording = false;
78
- let audioContext;
79
- let scriptProcessor;
80
- let audioAccumulatedChunks = [];
81
- let audioFlushIntervalId = null;
82
- let videoCaptureIntervalId = null;
83
- const SAMPLE_RATE = 16000;
84
- const BUFFER_SIZE = 4096;
85
- let mediaStream = null; // for video (and optionally audio if needed)
86
-
87
- // Global object to hold combined recording data.
88
- let recordingData = {};
89
-
90
- // Instead of calling notifyHost directly, update our combined data and send.
91
- function sendCombinedUpdate(key, value) {
92
- recordingData[key] = value;
93
- notifyHost({
94
- value: recordingData,
95
- dataType: "json"
96
- });
97
- }
98
-
99
- const videoElement = document.getElementById("videoPreview");
100
- const statusSpan = document.getElementById("status");
101
- const startButton = document.getElementById("startButton");
102
- const stopButton = document.getElementById("stopButton");
103
-
104
- // --- Start Recording: Capture both audio and video ---
105
- async function startRecording() {
106
- if (isRecording) return;
107
- isRecording = true;
108
- startButton.disabled = true;
109
- stopButton.disabled = false;
110
- statusSpan.innerText = "Streaming...";
111
-
112
- // --- Setup audio recording ---
113
- try {
114
- audioContext = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: SAMPLE_RATE });
115
- let audioStream = await navigator.mediaDevices.getUserMedia({ audio: true });
116
- let mediaStreamSource = audioContext.createMediaStreamSource(audioStream);
117
- scriptProcessor = audioContext.createScriptProcessor(BUFFER_SIZE, 1, 1);
118
- scriptProcessor.onaudioprocess = function(event) {
119
- let inputBuffer = event.inputBuffer;
120
- let inputData = inputBuffer.getChannelData(0);
121
- let pcmData = new Int16Array(inputData.length);
122
- for (let i = 0; i < inputData.length; i++) {
123
- let s = Math.max(-1, Math.min(1, inputData[i]));
124
- pcmData[i] = s < 0 ? s * 0x8000 : s * 0x7FFF;
125
- }
126
- audioAccumulatedChunks.push(pcmData);
127
- };
128
- mediaStreamSource.connect(scriptProcessor);
129
- scriptProcessor.connect(audioContext.destination);
130
- } catch (err) {
131
- console.error("Error accessing microphone:", err);
132
- statusSpan.innerText = "Audio Error: " + err;
133
- }
134
-
135
- // --- Setup video recording ---
136
- try {
137
- let videoStream = await navigator.mediaDevices.getUserMedia({ video: true });
138
- videoElement.srcObject = videoStream;
139
- // Save the video stream so we can stop it later.
140
- mediaStream = videoStream;
141
- } catch (err) {
142
- console.error("Error accessing camera:", err);
143
- statusSpan.innerText = "Video Error: " + err;
144
- }
145
-
146
- // --- Start interval timers for flushing audio and capturing video ---
147
- videoCaptureIntervalId = setInterval(captureVideoFrame, 250); // every 250ms
148
- audioFlushIntervalId = setInterval(flushAudioChunks, 250); // every 250ms
149
- }
150
-
151
- // --- Stop Recording ---
152
- function stopRecording() {
153
- if (!isRecording) return;
154
- isRecording = false;
155
- startButton.disabled = false;
156
- stopButton.disabled = true;
157
- statusSpan.innerText = "Stopped.";
158
-
159
- // Stop audio processing
160
- if (scriptProcessor) {
161
- scriptProcessor.disconnect();
162
- scriptProcessor = null;
163
- }
164
- if (audioContext) {
165
- audioContext.close();
166
- audioContext = null;
167
- }
168
- if (audioFlushIntervalId) {
169
- clearInterval(audioFlushIntervalId);
170
- audioFlushIntervalId = null;
171
- }
172
-
173
- // Stop video stream
174
- if (mediaStream) {
175
- mediaStream.getTracks().forEach(track => track.stop());
176
- mediaStream = null;
177
- }
178
- if (videoCaptureIntervalId) {
179
- clearInterval(videoCaptureIntervalId);
180
- videoCaptureIntervalId = null;
181
- }
182
-
183
- // Flush any remaining audio chunks
184
- flushAudioChunks();
185
-
186
- // Final notification that recording has stopped.
187
- sendCombinedUpdate("message", "Recording stopped");
188
- sendCombinedUpdate("isRecording", false);
189
- }
190
-
191
- // --- Flush accumulated audio chunks ---
192
- function flushAudioChunks() {
193
- if (audioAccumulatedChunks.length === 0) return;
194
- // Combine all audio chunks into one array.
195
- let totalLength = audioAccumulatedChunks.reduce((sum, chunk) => sum + chunk.length, 0);
196
- let combined = new Int16Array(totalLength);
197
- let offset = 0;
198
- for (let chunk of audioAccumulatedChunks) {
199
- combined.set(chunk, offset);
200
- offset += chunk.length;
201
- }
202
- audioAccumulatedChunks = []; // clear accumulator
203
-
204
- // Convert combined PCM data to a Blob.
205
- let blob = new Blob([combined.buffer], { type: 'application/octet-stream' });
206
- let reader = new FileReader();
207
- reader.onloadend = function() {
208
- // Instead of sending only audio, update the combined data.
209
- sendCombinedUpdate("audioChunk", reader.result);
210
- };
211
- reader.readAsDataURL(blob);
212
- }
213
-
214
- // --- Capture a single video frame ---
215
- function captureVideoFrame() {
216
- if (!videoElement.srcObject) return;
217
- const canvas = document.createElement("canvas");
218
- canvas.width = videoElement.videoWidth || 320;
219
- canvas.height = videoElement.videoHeight || 240;
220
- const ctx = canvas.getContext("2d");
221
- ctx.drawImage(videoElement, 0, 0, canvas.width, canvas.height);
222
- let dataUrl = canvas.toDataURL("image/jpeg");
223
- // Instead of a separate notifyHost call, update the combined data.
224
- sendCombinedUpdate("videoFrame", dataUrl);
225
- }
226
- </script>
227
- </body>
228
- </html>