spagestic commited on
Commit
a83f634
·
1 Parent(s): 85aa2e5

Refactored tool schemas into a dedicated file

Browse files
ui/inference/config.py CHANGED
@@ -1,80 +1,9 @@
1
  # ui/inference/config.py
2
  from __future__ import annotations
3
 
4
- from typing import Any
5
 
6
  MODEL_ID = "Qwen/Qwen3.6-27B"
7
  MAX_TOOL_ROUNDS = 5
8
 
9
- TOOLS: list[dict[str, Any]] = [
10
- {
11
- "type": "function",
12
- "function": {
13
- "name": "get_economic_indicator",
14
- "description": (
15
- "Fetch World Bank economic indicator time series for a country. "
16
- "Use ISO-3 country codes (e.g. IND for India, HKG, USA, CHN) and "
17
- "World Bank indicator codes (e.g. NY.GDP.MKTP.CD for GDP in "
18
- "current US dollars)."
19
- ),
20
- "parameters": {
21
- "type": "object",
22
- "properties": {
23
- "indicator": {
24
- "type": "string",
25
- "description": "World Bank indicator code, e.g. NY.GDP.MKTP.CD",
26
- },
27
- "country": {
28
- "type": "string",
29
- "description": "ISO-3 country code, e.g. IND, HKG, USA",
30
- },
31
- },
32
- "required": ["indicator", "country"],
33
- },
34
- },
35
- },
36
- {
37
- "type": "function",
38
- "function": {
39
- "name": "get_visa_requirement",
40
- "description": (
41
- "Get visa requirement details for a passport country traveling to "
42
- "a destination country. Use ISO-2 country codes."
43
- ),
44
- "parameters": {
45
- "type": "object",
46
- "properties": {
47
- "passport_iso2": {
48
- "type": "string",
49
- "description": "Passport issuing country ISO-2 code, e.g. HK, US, IN",
50
- },
51
- "destination_iso2": {
52
- "type": "string",
53
- "description": "Destination country ISO-2 code, e.g. GB, JP, US",
54
- },
55
- },
56
- "required": ["passport_iso2", "destination_iso2"],
57
- },
58
- },
59
- },
60
- {
61
- "type": "function",
62
- "function": {
63
- "name": "get_passport_stats",
64
- "description": (
65
- "Get aggregate visa access stats for a passport country. Use ISO-2 "
66
- "country codes."
67
- ),
68
- "parameters": {
69
- "type": "object",
70
- "properties": {
71
- "passport_iso2": {
72
- "type": "string",
73
- "description": "Passport issuing country ISO-2 code, e.g. HK, US, IN",
74
- },
75
- },
76
- "required": ["passport_iso2"],
77
- },
78
- },
79
- },
80
- ]
 
1
  # ui/inference/config.py
2
  from __future__ import annotations
3
 
4
+ from .tool_schemas import TOOL_SCHEMAS
5
 
6
  MODEL_ID = "Qwen/Qwen3.6-27B"
7
  MAX_TOOL_ROUNDS = 5
8
 
9
+ TOOLS = TOOL_SCHEMAS
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ui/inference/tool_schemas/__init__.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from .get_economic_indicator import SCHEMA as get_economic_indicator
6
+ from .get_passport_stats import SCHEMA as get_passport_stats
7
+ from .get_visa_requirement import SCHEMA as get_visa_requirement
8
+
9
+ TOOL_SCHEMAS: list[dict[str, Any]] = [
10
+ get_economic_indicator,
11
+ get_visa_requirement,
12
+ get_passport_stats,
13
+ ]
ui/inference/tool_schemas/get_economic_indicator.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ SCHEMA: dict[str, Any] = {
6
+ "type": "function",
7
+ "function": {
8
+ "name": "get_economic_indicator",
9
+ "description": (
10
+ "Fetch World Bank economic indicator time series for a country. "
11
+ "Use ISO-3 country codes (e.g. IND for India, HKG, USA, CHN) and "
12
+ "World Bank indicator codes (e.g. NY.GDP.MKTP.CD for GDP in "
13
+ "current US dollars)."
14
+ ),
15
+ "parameters": {
16
+ "type": "object",
17
+ "properties": {
18
+ "indicator": {
19
+ "type": "string",
20
+ "description": "World Bank indicator code, e.g. NY.GDP.MKTP.CD",
21
+ },
22
+ "country": {
23
+ "type": "string",
24
+ "description": "ISO-3 country code, e.g. IND, HKG, USA",
25
+ },
26
+ },
27
+ "required": ["indicator", "country"],
28
+ },
29
+ },
30
+ }
ui/inference/tool_schemas/get_passport_stats.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ SCHEMA: dict[str, Any] = {
6
+ "type": "function",
7
+ "function": {
8
+ "name": "get_passport_stats",
9
+ "description": (
10
+ "Get aggregate visa access stats for a passport country. Use ISO-2 "
11
+ "country codes."
12
+ ),
13
+ "parameters": {
14
+ "type": "object",
15
+ "properties": {
16
+ "passport_iso2": {
17
+ "type": "string",
18
+ "description": "Passport issuing country ISO-2 code, e.g. HK, US, IN",
19
+ },
20
+ },
21
+ "required": ["passport_iso2"],
22
+ },
23
+ },
24
+ }
ui/inference/tool_schemas/get_visa_requirement.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ SCHEMA: dict[str, Any] = {
6
+ "type": "function",
7
+ "function": {
8
+ "name": "get_visa_requirement",
9
+ "description": (
10
+ "Get visa requirement details for a passport country traveling to "
11
+ "a destination country. Use ISO-2 country codes."
12
+ ),
13
+ "parameters": {
14
+ "type": "object",
15
+ "properties": {
16
+ "passport_iso2": {
17
+ "type": "string",
18
+ "description": "Passport issuing country ISO-2 code, e.g. HK, US, IN",
19
+ },
20
+ "destination_iso2": {
21
+ "type": "string",
22
+ "description": "Destination country ISO-2 code, e.g. GB, JP, US",
23
+ },
24
+ },
25
+ "required": ["passport_iso2", "destination_iso2"],
26
+ },
27
+ },
28
+ }