humex 0.2.0__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.
- humex-0.2.0/LICENSE +201 -0
- humex-0.2.0/NOTICE +27 -0
- humex-0.2.0/PKG-INFO +69 -0
- humex-0.2.0/README.md +17 -0
- humex-0.2.0/pyproject.toml +88 -0
- humex-0.2.0/setup.cfg +4 -0
- humex-0.2.0/src/humex/__init__.py +50 -0
- humex-0.2.0/src/humex/api/__init__.py +28 -0
- humex-0.2.0/src/humex/api/ai_api/__init__.py +18 -0
- humex-0.2.0/src/humex/api/ai_api/chat.py +91 -0
- humex-0.2.0/src/humex/api/ai_api/models/__init__.py +6 -0
- humex-0.2.0/src/humex/api/ai_api/models/_claude_cli.py +109 -0
- humex-0.2.0/src/humex/api/ai_api/models/_qwen.py +124 -0
- humex-0.2.0/src/humex/api/ai_api/prompts/__init__.py +5 -0
- humex-0.2.0/src/humex/api/ai_api/prompts/dag_preprompt.txt +413 -0
- humex-0.2.0/src/humex/api/ai_api/prompts/system_monitor_operator_dag.txt +596 -0
- humex-0.2.0/src/humex/api/ai_api/translate_metrics.py +371 -0
- humex-0.2.0/src/humex/api/core_apis.py +121 -0
- humex-0.2.0/src/humex/api/metrics_api/__init__.py +19 -0
- humex-0.2.0/src/humex/api/metrics_api/_metrics_result_utils.py +44 -0
- humex-0.2.0/src/humex/api/metrics_api/compute_analyzer_metrics_api.py +307 -0
- humex-0.2.0/src/humex/api/metrics_api/compute_dag_metrics_api.py +255 -0
- humex-0.2.0/src/humex/api/metrics_api/convert_analyzer_metrics_api.py +211 -0
- humex-0.2.0/src/humex/api/metrics_api/monitor_discovery_api.py +212 -0
- humex-0.2.0/src/humex/api/metrics_api/operator_discovery_api.py +269 -0
- humex-0.2.0/src/humex/api/metrics_api/test_dag_metrics_api.py +153 -0
- humex-0.2.0/src/humex/api/metrics_api/visualize_dag_api.py +132 -0
- humex-0.2.0/src/humex/api/preview_api/__init__.py +5 -0
- humex-0.2.0/src/humex/api/preview_api/keyframe_preview_api.py +194 -0
- humex-0.2.0/src/humex/api/scenario_api/__init__.py +5 -0
- humex-0.2.0/src/humex/api/scenario_api/load_scenario_api.py +643 -0
- humex-0.2.0/src/humex/api/simulation_api/__init__.py +17 -0
- humex-0.2.0/src/humex/api/simulation_api/run_simulation_api.py +434 -0
- humex-0.2.0/src/humex/api/simulation_api/run_simulation_with_analyzer_metrics_api.py +92 -0
- humex-0.2.0/src/humex/api/simulation_api/run_simulation_with_dag_metrics_api.py +88 -0
- humex-0.2.0/src/humex/cli/__init__.py +1 -0
- humex-0.2.0/src/humex/cli/convert.py +340 -0
- humex-0.2.0/src/humex/cli/evaluate.py +60 -0
- humex-0.2.0/src/humex/cli/lane_map.py +42 -0
- humex-0.2.0/src/humex/cli/main.py +29 -0
- humex-0.2.0/src/humex/cli/package.py +45 -0
- humex-0.2.0/src/humex/cli/plugins.py +77 -0
- humex-0.2.0/src/humex/components/__init__.py +18 -0
- humex-0.2.0/src/humex/components/frame.py +152 -0
- humex-0.2.0/src/humex/components/object.py +521 -0
- humex-0.2.0/src/humex/components/perception.py +49 -0
- humex-0.2.0/src/humex/components/scenario.py +128 -0
- humex-0.2.0/src/humex/components/statepoint.py +316 -0
- humex-0.2.0/src/humex/components/trajectory.py +260 -0
- humex-0.2.0/src/humex/convert/__init__.py +28 -0
- humex-0.2.0/src/humex/convert/enhance.py +212 -0
- humex-0.2.0/src/humex/convert/lane_map.py +41 -0
- humex-0.2.0/src/humex/convert/pipeline.py +156 -0
- humex-0.2.0/src/humex/convert/role.py +54 -0
- humex-0.2.0/src/humex/converters/__init__.py +18 -0
- humex-0.2.0/src/humex/converters/base.py +163 -0
- humex-0.2.0/src/humex/converters/humex_packager.py +102 -0
- humex-0.2.0/src/humex/converters/registry.py +110 -0
- humex-0.2.0/src/humex/converters/testing.py +118 -0
- humex-0.2.0/src/humex/hmap/__init__.py +22 -0
- humex-0.2.0/src/humex/hmap/hmap.py +156 -0
- humex-0.2.0/src/humex/hmap/lane_map.py +669 -0
- humex-0.2.0/src/humex/hmap/lane_map_builder.py +576 -0
- humex-0.2.0/src/humex/hmap/lane_map_geometry.py +287 -0
- humex-0.2.0/src/humex/hmap/road_map.py +743 -0
- humex-0.2.0/src/humex/hmap/road_map_builder.py +140 -0
- humex-0.2.0/src/humex/hmap/road_map_loader.py +407 -0
- humex-0.2.0/src/humex/hmap/role_table.py +286 -0
- humex-0.2.0/src/humex/hmap/role_table_builder.py +652 -0
- humex-0.2.0/src/humex/metrics/__init__.py +5 -0
- humex-0.2.0/src/humex/metrics/analyzer/__init__.py +25 -0
- humex-0.2.0/src/humex/metrics/analyzer/analyzer_converter.py +305 -0
- humex-0.2.0/src/humex/metrics/analyzer/common.py +211 -0
- humex-0.2.0/src/humex/metrics/analyzer/dag_builder.py +368 -0
- humex-0.2.0/src/humex/metrics/analyzer/dag_converter.py +148 -0
- humex-0.2.0/src/humex/metrics/analyzer/logic_converter.py +266 -0
- humex-0.2.0/src/humex/metrics/dag/__init__.py +34 -0
- humex-0.2.0/src/humex/metrics/dag/dag.py +133 -0
- humex-0.2.0/src/humex/metrics/dag/dag_evaluator.py +699 -0
- humex-0.2.0/src/humex/metrics/dag/dag_evaluator_test.py +329 -0
- humex-0.2.0/src/humex/metrics/dag/dag_node.py +34 -0
- humex-0.2.0/src/humex/metrics/dag/dag_visualizer.py +357 -0
- humex-0.2.0/src/humex/metrics/dag/mock_dag_evaluator.py +98 -0
- humex-0.2.0/src/humex/metrics/metric_trace.py +123 -0
- humex-0.2.0/src/humex/metrics/monitors/__init__.py +52 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/__init__.py +0 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/_front_vehicle_utils.py +147 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/ego_acceleration.py +32 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/ego_center_offset.py +89 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/ego_collision.py +93 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/ego_heading.py +44 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/ego_lane_speed_limit.py +74 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/ego_lat_accel.py +54 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/ego_lon_accel.py +53 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/ego_lon_jerk.py +124 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/ego_out_of_map.py +126 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/ego_speed.py +30 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/ego_speed_excess.py +80 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/ego_yaw_rate.py +88 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/frame_interval.py +43 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/front_vehicle_distance.py +46 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/front_vehicle_id.py +40 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/lane_change_state.py +19 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/lateral_distance.py +102 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/lon_dist.py +16 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/mock_monitor.py +30 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/object_within_ego_buffer.py +105 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/stop_line_crossed.py +148 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/time_headway.py +50 -0
- humex-0.2.0/src/humex/metrics/monitors/catalog/ttc_front_vehicle.py +104 -0
- humex-0.2.0/src/humex/metrics/monitors/monitor_base.py +185 -0
- humex-0.2.0/src/humex/metrics/monitors/monitor_evaluator.py +84 -0
- humex-0.2.0/src/humex/metrics/operators/__init__.py +265 -0
- humex-0.2.0/src/humex/metrics/operators/aggregate.py +119 -0
- humex-0.2.0/src/humex/metrics/operators/arithmetic.py +97 -0
- humex-0.2.0/src/humex/metrics/operators/chain_result.py +37 -0
- humex-0.2.0/src/humex/metrics/operators/compare.py +126 -0
- humex-0.2.0/src/humex/metrics/operators/compare_test.py +641 -0
- humex-0.2.0/src/humex/metrics/operators/duration.py +168 -0
- humex-0.2.0/src/humex/metrics/operators/logic.py +68 -0
- humex-0.2.0/src/humex/metrics/operators/mask.py +128 -0
- humex-0.2.0/src/humex/metrics/operators/observe.py +35 -0
- humex-0.2.0/src/humex/metrics/operators/operator_base.py +176 -0
- humex-0.2.0/src/humex/metrics/operators/reduce.py +119 -0
- humex-0.2.0/src/humex/metrics/operators/scenario_window.py +46 -0
- humex-0.2.0/src/humex/metrics/operators/transform.py +67 -0
- humex-0.2.0/src/humex/metrics/operators/within.py +154 -0
- humex-0.2.0/src/humex/metrics/operators/within_test.py +217 -0
- humex-0.2.0/src/humex/proto/__init__.py +18 -0
- humex-0.2.0/src/humex/proto/lane_map_pb2.py +40 -0
- humex-0.2.0/src/humex/proto/map_pb2.py +43 -0
- humex-0.2.0/src/humex/proto/map_pb2.pyi +84 -0
- humex-0.2.0/src/humex/proto/metric_dag_pb2.py +41 -0
- humex-0.2.0/src/humex/proto/metric_dag_pb2.pyi +55 -0
- humex-0.2.0/src/humex/proto/metric_result_pb2.py +39 -0
- humex-0.2.0/src/humex/proto/metric_result_pb2.pyi +59 -0
- humex-0.2.0/src/humex/proto/proto_utils.py +32 -0
- humex-0.2.0/src/humex/proto/py.typed +0 -0
- humex-0.2.0/src/humex/proto/robot_pb2.py +53 -0
- humex-0.2.0/src/humex/proto/role_pb2.py +41 -0
- humex-0.2.0/src/humex/proto/scenario_pb2.py +55 -0
- humex-0.2.0/src/humex/proto/scenario_pb2.pyi +107 -0
- humex-0.2.0/src/humex/proto/service_pb2.py +55 -0
- humex-0.2.0/src/humex/proto/service_pb2.pyi +84 -0
- humex-0.2.0/src/humex/proto/signal_pb2.py +35 -0
- humex-0.2.0/src/humex/proto/signal_pb2.pyi +52 -0
- humex-0.2.0/src/humex/simulator/__init__.py +6 -0
- humex-0.2.0/src/humex/simulator/behavior/__init__.py +11 -0
- humex-0.2.0/src/humex/simulator/behavior/behavior_base.py +56 -0
- humex-0.2.0/src/humex/simulator/behavior/keyframe.py +367 -0
- humex-0.2.0/src/humex/simulator/behavior/smartkeyframe.py +610 -0
- humex-0.2.0/src/humex/simulator/simulator.py +293 -0
- humex-0.2.0/src/humex/simulator/vehicle/__init__.py +6 -0
- humex-0.2.0/src/humex/simulator/vehicle/controllers.py +286 -0
- humex-0.2.0/src/humex/simulator/vehicle/models.py +91 -0
- humex-0.2.0/src/humex/simulator/visualizer/__init__.py +23 -0
- humex-0.2.0/src/humex/simulator/visualizer/video_renderer.py +431 -0
- humex-0.2.0/src/humex/simulator/visualizer/visualizer_3d.py +583 -0
- humex-0.2.0/src/humex/utils/__init__.py +14 -0
- humex-0.2.0/src/humex/utils/data_loader.py +220 -0
- humex-0.2.0/src/humex/utils/dubins_utils.py +231 -0
- humex-0.2.0/src/humex/utils/math_helper.py +397 -0
- humex-0.2.0/src/humex/utils/paths.py +88 -0
- humex-0.2.0/src/humex/utils/physics_helper.py +340 -0
- humex-0.2.0/src/humex/utils/timestamp.py +109 -0
- humex-0.2.0/src/humex.egg-info/PKG-INFO +69 -0
- humex-0.2.0/src/humex.egg-info/SOURCES.txt +184 -0
- humex-0.2.0/src/humex.egg-info/dependency_links.txt +1 -0
- humex-0.2.0/src/humex.egg-info/entry_points.txt +2 -0
- humex-0.2.0/src/humex.egg-info/requires.txt +34 -0
- humex-0.2.0/src/humex.egg-info/top_level.txt +1 -0
- humex-0.2.0/tests/test_arithmetic_operator.py +260 -0
- humex-0.2.0/tests/test_compute_dag_metrics_api.py +218 -0
- humex-0.2.0/tests/test_front_vehicle_lane_graph.py +343 -0
- humex-0.2.0/tests/test_hmap.py +103 -0
- humex-0.2.0/tests/test_lane_follow_car.py +185 -0
- humex-0.2.0/tests/test_lane_map_overlap.py +151 -0
- humex-0.2.0/tests/test_lane_map_query.py +161 -0
- humex-0.2.0/tests/test_lane_map_v2_builder.py +271 -0
- humex-0.2.0/tests/test_logic_operator.py +194 -0
- humex-0.2.0/tests/test_monitor_ego_absent.py +237 -0
- humex-0.2.0/tests/test_observe_operator.py +130 -0
- humex-0.2.0/tests/test_role_table_builder.py +405 -0
- humex-0.2.0/tests/test_scenario_window_operator.py +163 -0
- humex-0.2.0/tests/test_test_dag_metrics_api.py +574 -0
- humex-0.2.0/tests/test_time_headway_dispatch.py +157 -0
humex-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 humex contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
humex-0.2.0/NOTICE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
humex
|
|
2
|
+
Copyright 2026 humex contributors
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0
|
|
5
|
+
(see the LICENSE file in this repository).
|
|
6
|
+
|
|
7
|
+
----------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
Bundled / vendored components
|
|
10
|
+
-----------------------------
|
|
11
|
+
|
|
12
|
+
humex vendors the following components, all of which were originally
|
|
13
|
+
authored by humex contributors and are released under the same Apache
|
|
14
|
+
License, Version 2.0 as humex itself:
|
|
15
|
+
|
|
16
|
+
* The Protocol Buffer schemas under ``proto/`` and the generated
|
|
17
|
+
Python bindings under ``src/humex/proto/``.
|
|
18
|
+
* The dataset converters under ``src/humex/converters/`` (Waymo,
|
|
19
|
+
DROID-100, LAFAN1).
|
|
20
|
+
* The HD-map subsystem under ``src/humex/hmap/`` (``HMap`` facade,
|
|
21
|
+
``LaneMap``, ``RoadMap``, role table builder).
|
|
22
|
+
|
|
23
|
+
No third-party source code is bundled in this distribution. Required
|
|
24
|
+
third-party libraries (numpy, scipy, shapely, protobuf, click, rich,
|
|
25
|
+
PyYAML, requests, networkx) are installed at runtime via pip and
|
|
26
|
+
remain governed by their respective upstream licenses (BSD, MIT,
|
|
27
|
+
Apache 2.0, MPL 2.0).
|
humex-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: humex
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Behavioral metrics for autonomous-vehicle and physical-AI scenarios
|
|
5
|
+
Author-email: humex contributors <humex@zerothlaw.io>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/zerothlaw-ai/humex
|
|
8
|
+
Project-URL: Source, https://github.com/zerothlaw-ai/humex
|
|
9
|
+
Project-URL: Issues, https://github.com/zerothlaw-ai/humex/issues
|
|
10
|
+
Keywords: autonomous-vehicles,robotics,scenarios,metrics,simulation,waymo,droid,lafan
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
License-File: NOTICE
|
|
24
|
+
Requires-Dist: numpy<3,>=1.23
|
|
25
|
+
Requires-Dist: shapely<3,>=2.0
|
|
26
|
+
Requires-Dist: scipy>=1.10
|
|
27
|
+
Requires-Dist: PyYAML>=6.0
|
|
28
|
+
Requires-Dist: protobuf<5,>=3.20
|
|
29
|
+
Requires-Dist: networkx>=2.6
|
|
30
|
+
Requires-Dist: requests>=2.28.0
|
|
31
|
+
Requires-Dist: click>=8
|
|
32
|
+
Requires-Dist: rich>=13
|
|
33
|
+
Provides-Extra: local
|
|
34
|
+
Requires-Dist: matplotlib<4.0,>=3.6.1; extra == "local"
|
|
35
|
+
Provides-Extra: test
|
|
36
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
37
|
+
Requires-Dist: pytest-cov>=3.0; extra == "test"
|
|
38
|
+
Provides-Extra: waymo
|
|
39
|
+
Requires-Dist: humex-converter-waymo; extra == "waymo"
|
|
40
|
+
Provides-Extra: droid
|
|
41
|
+
Requires-Dist: humex-converter-droid; extra == "droid"
|
|
42
|
+
Provides-Extra: lafan
|
|
43
|
+
Requires-Dist: humex-converter-lafan; extra == "lafan"
|
|
44
|
+
Provides-Extra: all
|
|
45
|
+
Requires-Dist: humex-converter-waymo; extra == "all"
|
|
46
|
+
Requires-Dist: humex-converter-droid; extra == "all"
|
|
47
|
+
Requires-Dist: humex-converter-lafan; extra == "all"
|
|
48
|
+
Provides-Extra: dev
|
|
49
|
+
Requires-Dist: ruff>=0.4.0; extra == "dev"
|
|
50
|
+
Requires-Dist: mypy>=1.8; extra == "dev"
|
|
51
|
+
Dynamic: license-file
|
|
52
|
+
|
|
53
|
+
# humex (core)
|
|
54
|
+
|
|
55
|
+
**Hu**man-**U**nderstandable **ME**trics for everything (**X**) — behavioral
|
|
56
|
+
metrics for autonomous-vehicle and physical-AI scenarios.
|
|
57
|
+
|
|
58
|
+
This is the core `humex` package — `ScenarioAPI`, `HMap`, metric DAGs,
|
|
59
|
+
monitors, and the CLI. **Converters ship as separate packages** so heavy
|
|
60
|
+
deps (TensorFlow for Waymo, pyarrow/pandas for DROID, …) don't get
|
|
61
|
+
pulled into a clean `humex` install.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install humex # core only
|
|
65
|
+
pip install humex[all] # core + all bundled converters
|
|
66
|
+
pip install humex humex-converter-waymo # core + just Waymo
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
See the [workspace README](../README.md) for the full picture.
|
humex-0.2.0/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# humex (core)
|
|
2
|
+
|
|
3
|
+
**Hu**man-**U**nderstandable **ME**trics for everything (**X**) — behavioral
|
|
4
|
+
metrics for autonomous-vehicle and physical-AI scenarios.
|
|
5
|
+
|
|
6
|
+
This is the core `humex` package — `ScenarioAPI`, `HMap`, metric DAGs,
|
|
7
|
+
monitors, and the CLI. **Converters ship as separate packages** so heavy
|
|
8
|
+
deps (TensorFlow for Waymo, pyarrow/pandas for DROID, …) don't get
|
|
9
|
+
pulled into a clean `humex` install.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install humex # core only
|
|
13
|
+
pip install humex[all] # core + all bundled converters
|
|
14
|
+
pip install humex humex-converter-waymo # core + just Waymo
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
See the [workspace README](../README.md) for the full picture.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=80", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "humex"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Behavioral metrics for autonomous-vehicle and physical-AI scenarios"
|
|
9
|
+
authors = [{name = "humex contributors", email = "humex@zerothlaw.io"}]
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
license = "Apache-2.0"
|
|
13
|
+
keywords = [
|
|
14
|
+
"autonomous-vehicles",
|
|
15
|
+
"robotics",
|
|
16
|
+
"scenarios",
|
|
17
|
+
"metrics",
|
|
18
|
+
"simulation",
|
|
19
|
+
"waymo",
|
|
20
|
+
"droid",
|
|
21
|
+
"lafan",
|
|
22
|
+
]
|
|
23
|
+
classifiers = [
|
|
24
|
+
"Development Status :: 4 - Beta",
|
|
25
|
+
"Intended Audience :: Developers",
|
|
26
|
+
"Intended Audience :: Science/Research",
|
|
27
|
+
"Operating System :: OS Independent",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"Programming Language :: Python :: 3.10",
|
|
30
|
+
"Programming Language :: Python :: 3.11",
|
|
31
|
+
"Topic :: Scientific/Engineering",
|
|
32
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
33
|
+
]
|
|
34
|
+
dependencies = [
|
|
35
|
+
"numpy>=1.23,<3",
|
|
36
|
+
"shapely>=2.0,<3",
|
|
37
|
+
"scipy>=1.10",
|
|
38
|
+
"PyYAML>=6.0",
|
|
39
|
+
"protobuf>=3.20,<5",
|
|
40
|
+
"networkx>=2.6",
|
|
41
|
+
"requests>=2.28.0",
|
|
42
|
+
"click>=8",
|
|
43
|
+
"rich>=13",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.optional-dependencies]
|
|
47
|
+
local = [
|
|
48
|
+
"matplotlib>=3.6.1,<4.0",
|
|
49
|
+
]
|
|
50
|
+
test = [
|
|
51
|
+
"pytest>=7.0",
|
|
52
|
+
"pytest-cov>=3.0",
|
|
53
|
+
]
|
|
54
|
+
# Convenience meta-extras for installing converter plugins alongside the
|
|
55
|
+
# core. Each plugin is its own PyPI package with its own deps; these
|
|
56
|
+
# extras just bundle them so `pip install humex[all]` keeps working for
|
|
57
|
+
# users who want the same one-line install as before the split.
|
|
58
|
+
waymo = ["humex-converter-waymo"]
|
|
59
|
+
droid = ["humex-converter-droid"]
|
|
60
|
+
lafan = ["humex-converter-lafan"]
|
|
61
|
+
all = [
|
|
62
|
+
"humex-converter-waymo",
|
|
63
|
+
"humex-converter-droid",
|
|
64
|
+
"humex-converter-lafan",
|
|
65
|
+
]
|
|
66
|
+
dev = [
|
|
67
|
+
"ruff>=0.4.0",
|
|
68
|
+
"mypy>=1.8",
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[project.urls]
|
|
72
|
+
Homepage = "https://github.com/zerothlaw-ai/humex"
|
|
73
|
+
Source = "https://github.com/zerothlaw-ai/humex"
|
|
74
|
+
Issues = "https://github.com/zerothlaw-ai/humex/issues"
|
|
75
|
+
|
|
76
|
+
[tool.setuptools.packages.find]
|
|
77
|
+
where = ["src"]
|
|
78
|
+
|
|
79
|
+
[tool.setuptools.package-data]
|
|
80
|
+
"humex.api.ai_api.prompts" = ["*.txt"]
|
|
81
|
+
"humex.proto" = ["*.pyi", "py.typed"]
|
|
82
|
+
|
|
83
|
+
[project.scripts]
|
|
84
|
+
humex = "humex.cli.main:cli"
|
|
85
|
+
|
|
86
|
+
[tool.pytest.ini_options]
|
|
87
|
+
testpaths = ["tests"]
|
|
88
|
+
addopts = "-ra --strict-markers"
|
humex-0.2.0/setup.cfg
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""humex — behavioral metrics for autonomous-vehicle and physical-AI scenarios.
|
|
2
|
+
|
|
3
|
+
High-level Python APIs for:
|
|
4
|
+
- Loading and preparing scenarios
|
|
5
|
+
- Analyzing scenarios with metrics
|
|
6
|
+
- Converting and computing metric DAGs
|
|
7
|
+
- Natural language interaction via LLM
|
|
8
|
+
|
|
9
|
+
See ``humex.api.core_apis`` for a comprehensive facade listing all public APIs
|
|
10
|
+
with full signatures, parameter descriptions, and usage examples::
|
|
11
|
+
|
|
12
|
+
import humex.api.core_apis
|
|
13
|
+
help(humex.api.core_apis)
|
|
14
|
+
|
|
15
|
+
from humex.api.core_apis import (
|
|
16
|
+
analyze,
|
|
17
|
+
ScenarioAPI,
|
|
18
|
+
ConvertAnalyzerMetricsAPI,
|
|
19
|
+
ComputeAnalyzerMetricsAPI,
|
|
20
|
+
)
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from .api import (
|
|
24
|
+
Chat,
|
|
25
|
+
ScenarioAPI,
|
|
26
|
+
ConvertAnalyzerMetricsAPI,
|
|
27
|
+
ComputeAnalyzerMetricsAPI,
|
|
28
|
+
)
|
|
29
|
+
from .hmap import HMap, LaneMap, RoadMap, RoleTable, build_lane_map, build_role_table
|
|
30
|
+
|
|
31
|
+
__version__ = "0.2.0"
|
|
32
|
+
|
|
33
|
+
# Plugin-API version. Converter plugins may declare a ``MIN_HUMEX_API_VERSION``
|
|
34
|
+
# class attr; the registry skips converters whose minimum exceeds this value
|
|
35
|
+
# instead of letting an incompatible plugin crash the host. Bump on breaking
|
|
36
|
+
# changes to BaseConverter / ConversionResult / registry contracts.
|
|
37
|
+
__api_version__ = 1
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
"ScenarioAPI",
|
|
41
|
+
"ConvertAnalyzerMetricsAPI",
|
|
42
|
+
"ComputeAnalyzerMetricsAPI",
|
|
43
|
+
"Chat",
|
|
44
|
+
"HMap",
|
|
45
|
+
"LaneMap",
|
|
46
|
+
"RoadMap",
|
|
47
|
+
"RoleTable",
|
|
48
|
+
"build_lane_map",
|
|
49
|
+
"build_role_table",
|
|
50
|
+
]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""High-level API for humex framework.
|
|
2
|
+
|
|
3
|
+
This module provides convenient Python functions and classes for analyzing scenarios,
|
|
4
|
+
loading scenarios, converting metrics configs, and interacting with humex via natural language.
|
|
5
|
+
|
|
6
|
+
Classes:
|
|
7
|
+
- ScenarioAPI: Load scenarios from various sources
|
|
8
|
+
- ConvertAnalyzerMetricsAPI: Convert analyzer configs to DAG format
|
|
9
|
+
- ComputeAnalyzerMetricsAPI: End-to-end metrics computation
|
|
10
|
+
- Chat: LLM chat interface
|
|
11
|
+
- TranslateMetrics: Natural language to metrics config translator
|
|
12
|
+
|
|
13
|
+
Functions (for backward compatibility):
|
|
14
|
+
- chat(): Functional chat interface
|
|
15
|
+
- translate_metrics(): Functional metrics translation interface
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from .scenario_api import ScenarioAPI
|
|
19
|
+
from .metrics_api import ConvertAnalyzerMetricsAPI, ComputeAnalyzerMetricsAPI
|
|
20
|
+
from .ai_api import Chat, TranslateMetrics
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
'ScenarioAPI',
|
|
24
|
+
'ConvertAnalyzerMetricsAPI',
|
|
25
|
+
'ComputeAnalyzerMetricsAPI',
|
|
26
|
+
'Chat',
|
|
27
|
+
'TranslateMetrics',
|
|
28
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""AI API module providing LLM integration with pluggable model support.
|
|
2
|
+
|
|
3
|
+
This module provides interfaces to various AI models (currently Claude via Claude CLI)
|
|
4
|
+
for tasks like chat interactions and metrics requirement translation.
|
|
5
|
+
|
|
6
|
+
Classes:
|
|
7
|
+
- Chat: Class-based chat interface
|
|
8
|
+
- TranslateMetrics: Class-based metrics translation interface
|
|
9
|
+
|
|
10
|
+
Functions (for backward compatibility):
|
|
11
|
+
- chat(): Functional chat interface
|
|
12
|
+
- translate_metrics(): Functional metrics translation interface
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from humex.api.ai_api.chat import Chat
|
|
16
|
+
from humex.api.ai_api.translate_metrics import TranslateMetrics
|
|
17
|
+
|
|
18
|
+
__all__ = ["Chat", "TranslateMetrics"]
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""Chat API for humex framework interactions."""
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from humex.api.ai_api.models._claude_cli import ClaudeCLIModel
|
|
6
|
+
from humex.api.ai_api.models._qwen import QwenModel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Chat:
|
|
10
|
+
"""Chat interface for humex-related queries.
|
|
11
|
+
|
|
12
|
+
Provides a conversational interface for asking questions and getting advice
|
|
13
|
+
about humex framework, scenarios, metrics, and analysis.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
def __init__(self, model: str = "claude_cli", qwen_model: Optional[str] = None):
|
|
17
|
+
"""Initialize Chat with specified model.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
model: Model to use for chat. Supports "claude_cli" (default) or "qwen".
|
|
21
|
+
qwen_model: Ollama model name when using "qwen" (default: "qwen2.5:0.5b").
|
|
22
|
+
Examples: "qwen2.5:0.5b", "qwen2.5:7b", "qwen2.5-coder:7b"
|
|
23
|
+
|
|
24
|
+
Raises:
|
|
25
|
+
ValueError: If an unsupported model is specified
|
|
26
|
+
"""
|
|
27
|
+
if model not in ("claude_cli", "qwen"):
|
|
28
|
+
raise ValueError(
|
|
29
|
+
f"Unsupported model: {model}. Supported models: 'claude_cli', 'qwen'"
|
|
30
|
+
)
|
|
31
|
+
self.model = model
|
|
32
|
+
self._qwen_instance = QwenModel(qwen_model) if model == "qwen" else None
|
|
33
|
+
|
|
34
|
+
def send(self, message: str, context: Optional[str] = None) -> str:
|
|
35
|
+
"""Send a chat message and get a response.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
message: User's question or message
|
|
39
|
+
context: Optional context about what the user is working on
|
|
40
|
+
(e.g., "scenario analysis", "metric configuration")
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
Plain text response string from the selected model
|
|
44
|
+
|
|
45
|
+
Raises:
|
|
46
|
+
FileNotFoundError: If Claude CLI is not installed (when using claude_cli)
|
|
47
|
+
Exception: If the model call fails
|
|
48
|
+
|
|
49
|
+
Example:
|
|
50
|
+
>>> chat_api = Chat()
|
|
51
|
+
>>> response = chat_api.send("How do I analyze a scenario?")
|
|
52
|
+
>>> print(response)
|
|
53
|
+
# Returns helpful response about analyzing scenarios
|
|
54
|
+
|
|
55
|
+
>>> response = chat_api.send("What metrics should I track?", context="vehicle safety")
|
|
56
|
+
>>> print(response)
|
|
57
|
+
# Returns response tailored to vehicle safety metrics
|
|
58
|
+
"""
|
|
59
|
+
if self.model == "claude_cli":
|
|
60
|
+
return ClaudeCLIModel.chat(message, context)
|
|
61
|
+
elif self.model == "qwen":
|
|
62
|
+
return self._qwen_instance.chat(message, context)
|
|
63
|
+
else:
|
|
64
|
+
raise ValueError(
|
|
65
|
+
f"Unsupported model: {self.model}. Supported models: 'claude_cli', 'qwen'"
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# Convenience function for backward compatibility
|
|
70
|
+
def chat(
|
|
71
|
+
message: str,
|
|
72
|
+
model: str = "claude_cli",
|
|
73
|
+
context: Optional[str] = None,
|
|
74
|
+
qwen_model: Optional[str] = None
|
|
75
|
+
) -> str:
|
|
76
|
+
"""Convenience function for chat interactions.
|
|
77
|
+
|
|
78
|
+
This function provides backward compatibility with the functional API.
|
|
79
|
+
For new code, consider using the Chat class directly.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
message: User's question or message
|
|
83
|
+
model: Model to use for chat (default: "claude_cli"). Supports "claude_cli" or "qwen".
|
|
84
|
+
context: Optional context about what the user is working on
|
|
85
|
+
qwen_model: Ollama model name when using "qwen" (default: "qwen2.5:0.5b")
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
Plain text response string from the selected model
|
|
89
|
+
"""
|
|
90
|
+
chat_api = Chat(model=model, qwen_model=qwen_model)
|
|
91
|
+
return chat_api.send(message, context=context)
|