aions-llm 1.0.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.
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.4
2
+ Name: aions-llm
3
+ Version: 1.0.0
4
+ Summary: Actions and Interface Object Notation: An open standard for LLM tools.
5
+ Author: Sourav Modak
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: langchain>=0.1.0
12
+
13
+ # AIONS: Actions and Interface Object Notation
14
+
15
+ **AIONS** (pronounced *IONS*) is an open-standard, text-based data format designed specifically for AI Large Language Models (LLMs). It allows developers to decouple tool definitions from core logic, making AI "Actions" as portable as JSON but as powerful as native Python.
16
+
17
+ ## πŸ›  Why AIONS?
18
+
19
+ Traditional AI tool registration often involves bloating your Python files with massive strings for descriptions and repetitive boilerplate. AIONS solves this by:
20
+ * **Decoupling:** Move your LLM prompts (descriptions) and tool mappings into external `.aion` files.
21
+ * **Dynamic Evaluation:** Supports native Python lambdas and complex logic directly within the notation.
22
+ * **Strict Validation:** Enforces a rigid property schema to prevent "ghost tools" or broken agent execution.
23
+ * **Zero-Map Architecture:** No need to maintain manual dictionaries; if it’s in the `.aion` file, it’s in your Agent.
24
+
25
+ ---
26
+
27
+ ## πŸ“œ The Laws of AIONS
28
+
29
+ To maintain the "Open Standard" integrity, every `.aion` file must adhere to the following rules:
30
+
31
+ ### 1. The Array Constraint
32
+ An AIONS definition must always be an array, enclosed in square brackets `[ ]`. Even if you are defining a single tool, it must reside within an array.
33
+
34
+ ### 2. The Arrow Operator
35
+ Properties are assigned using the "Action-Link" operator: `-->`.
36
+ * **Valid:** `name --> "MyTool"`
37
+ * **Invalid:** `name: "MyTool"` or `name = "MyTool"`
38
+
39
+ ### 3. Property Isolation
40
+ AIONS strictly enforces identified properties. If the parser encounters a top-level key that is not in the **Approved Registry**, it will throw an `AIONPropertyError`.
41
+ * **Approved Registry:** `name`, `function`, `description`, `args_schema`.
42
+
43
+ ### 4. The Function Block
44
+ The `function` property is a "Smart Property." It requires a raw string representing the executable (lambda or function name) followed by an "Interface Block" `{ }` describing the inputs and outputs.
45
+ * Inputs must follow the `arg-N` pattern.
46
+ * Outputs must follow the `return-N` pattern.
47
+
48
+ ---
49
+
50
+ ## πŸ“‚ Syntax Example
51
+ ### πŸ“ AIONS Syntax Guide
52
+
53
+ The AIONS (Actions and Interface Object Notation) syntax is designed to be strictly structural yet human-readable. It follows a specific set of rules to ensure LLM compatibility and execution safety.
54
+
55
+ #### 1. Global Wrapper
56
+ All tool definitions must be contained within a root-level array:
57
+ `[` ... `]`
58
+
59
+ #### 2. Tool Objects
60
+ Individual tools are defined as objects within curly braces:
61
+ `{` ... `}`
62
+
63
+ #### 3. The Action-Link Operator (-->)
64
+ AIONS uses the `-->` operator to map keys to values. Standard colon `:` or equals `=` assignments are invalid and will trigger a parse error.
65
+
66
+ #### 4. Top-Level Properties
67
+ Every tool object must contain the following identified properties:
68
+ * **name**: The unique identifier for the tool.
69
+ * **function**: The executable logic and interface mapping.
70
+ * **args_schema** (Optional): The Pydantic class name for input validation.
71
+ * **description**: The natural language instruction for the LLM.
72
+
73
+ #### 5. The Smart Function Block
74
+ The `function` property is split into two parts:
75
+ 1. **Executable String**: The lambda or function name (e.g., `"lambda x: func(x)"`).
76
+ 2. **Interface Block**: A nested `{}` mapping that defines parameters and returns.
77
+
78
+ #### πŸ’‘ Syntax Template:
79
+ ```text
80
+ {
81
+ name --> "Unique_Tool_Name",
82
+ function --> "executable_python_logic" --> {
83
+ arg-1 --> "Input description",
84
+ return-1 --> "Output description"
85
+ },
86
+ args_schema --> "PydanticClassName",
87
+ description --> "Detailed prompt for the AI agent"
88
+ }
89
+ ```
90
+
91
+ ## πŸš€ Getting Started
92
+ 1. Project Structure
93
+ Keep your tools organized. We recommend an aion_tools/ directory for modularity.
94
+
95
+ ```text
96
+ from aions import AIONS
97
+ import api_functions
98
+ from schemas import SendLikeInput
99
+
100
+ # 1. Load your tools with context
101
+ # 'globals()' allows AIONS to find your imported functions and schemas in memory
102
+ tools = AIONS.get_langchain_tools(
103
+ source_path="aion_tools/",
104
+ context=globals()
105
+ )
106
+
107
+ # 2. Pass them directly to your Agent
108
+ # agent = initialize_agent(tools, llm, ...)
109
+ ```
110
+
111
+ ## 2. Integration with LangChain
112
+ AIONS is built to be a first-class citizen in the LangChain ecosystem.
113
+
114
+ ```text
115
+ from aions import AIONS
116
+ import api_functions
117
+ from schemas import SendLikeInput
118
+
119
+ # 1. Load your tools with context
120
+ # 'globals()' allows AIONS to find your imported functions and schemas
121
+ tools = AIONS.get_langchain_tools(
122
+ source_path="aion_tools/",
123
+ context=globals()
124
+ )
125
+
126
+ # 2. Pass them directly to your Agent
127
+ # agent = initialize_agent(tools, llm, ...)
128
+ ```
129
+
130
+ ## βš–οΈ Error Handling
131
+
132
+ AIONS is designed to fail fast. This prevents your AI Agent from attempting to use a tool that was configured incorrectly.
133
+
134
+ | Error | Cause |
135
+ | :--- | :--- |
136
+ | `AIONPropertyError` | Using an unauthorized key (e.g., using `desc` instead of `description`). |
137
+ | `AIONParseError` | Syntax errors, missing brackets, or function strings that don't exist in your Python code. |
138
+
139
+ ## πŸ›  Extending the Framework
140
+ The AIONS class provides several utility methods for different workflows:
141
+
142
+ ```text
143
+ load_dir(path, context): Automatically stitches together all .aion files in a folder.
144
+
145
+ dumps(list_of_tools): Converts existing Python tool dictionaries into the AIONS standard text format.
146
+
147
+ get_langchain_tools(...): The high-level factory for instant LangChain mounting.
148
+ ```
149
+ ## 🀝 Contributing
150
+ AIONS is an open standard. Feel free to fork the framework and add support for other LLM frameworks.
151
+
152
+ Developed by Sourav Modak
@@ -0,0 +1,140 @@
1
+ # AIONS: Actions and Interface Object Notation
2
+
3
+ **AIONS** (pronounced *IONS*) is an open-standard, text-based data format designed specifically for AI Large Language Models (LLMs). It allows developers to decouple tool definitions from core logic, making AI "Actions" as portable as JSON but as powerful as native Python.
4
+
5
+ ## πŸ›  Why AIONS?
6
+
7
+ Traditional AI tool registration often involves bloating your Python files with massive strings for descriptions and repetitive boilerplate. AIONS solves this by:
8
+ * **Decoupling:** Move your LLM prompts (descriptions) and tool mappings into external `.aion` files.
9
+ * **Dynamic Evaluation:** Supports native Python lambdas and complex logic directly within the notation.
10
+ * **Strict Validation:** Enforces a rigid property schema to prevent "ghost tools" or broken agent execution.
11
+ * **Zero-Map Architecture:** No need to maintain manual dictionaries; if it’s in the `.aion` file, it’s in your Agent.
12
+
13
+ ---
14
+
15
+ ## πŸ“œ The Laws of AIONS
16
+
17
+ To maintain the "Open Standard" integrity, every `.aion` file must adhere to the following rules:
18
+
19
+ ### 1. The Array Constraint
20
+ An AIONS definition must always be an array, enclosed in square brackets `[ ]`. Even if you are defining a single tool, it must reside within an array.
21
+
22
+ ### 2. The Arrow Operator
23
+ Properties are assigned using the "Action-Link" operator: `-->`.
24
+ * **Valid:** `name --> "MyTool"`
25
+ * **Invalid:** `name: "MyTool"` or `name = "MyTool"`
26
+
27
+ ### 3. Property Isolation
28
+ AIONS strictly enforces identified properties. If the parser encounters a top-level key that is not in the **Approved Registry**, it will throw an `AIONPropertyError`.
29
+ * **Approved Registry:** `name`, `function`, `description`, `args_schema`.
30
+
31
+ ### 4. The Function Block
32
+ The `function` property is a "Smart Property." It requires a raw string representing the executable (lambda or function name) followed by an "Interface Block" `{ }` describing the inputs and outputs.
33
+ * Inputs must follow the `arg-N` pattern.
34
+ * Outputs must follow the `return-N` pattern.
35
+
36
+ ---
37
+
38
+ ## πŸ“‚ Syntax Example
39
+ ### πŸ“ AIONS Syntax Guide
40
+
41
+ The AIONS (Actions and Interface Object Notation) syntax is designed to be strictly structural yet human-readable. It follows a specific set of rules to ensure LLM compatibility and execution safety.
42
+
43
+ #### 1. Global Wrapper
44
+ All tool definitions must be contained within a root-level array:
45
+ `[` ... `]`
46
+
47
+ #### 2. Tool Objects
48
+ Individual tools are defined as objects within curly braces:
49
+ `{` ... `}`
50
+
51
+ #### 3. The Action-Link Operator (-->)
52
+ AIONS uses the `-->` operator to map keys to values. Standard colon `:` or equals `=` assignments are invalid and will trigger a parse error.
53
+
54
+ #### 4. Top-Level Properties
55
+ Every tool object must contain the following identified properties:
56
+ * **name**: The unique identifier for the tool.
57
+ * **function**: The executable logic and interface mapping.
58
+ * **args_schema** (Optional): The Pydantic class name for input validation.
59
+ * **description**: The natural language instruction for the LLM.
60
+
61
+ #### 5. The Smart Function Block
62
+ The `function` property is split into two parts:
63
+ 1. **Executable String**: The lambda or function name (e.g., `"lambda x: func(x)"`).
64
+ 2. **Interface Block**: A nested `{}` mapping that defines parameters and returns.
65
+
66
+ #### πŸ’‘ Syntax Template:
67
+ ```text
68
+ {
69
+ name --> "Unique_Tool_Name",
70
+ function --> "executable_python_logic" --> {
71
+ arg-1 --> "Input description",
72
+ return-1 --> "Output description"
73
+ },
74
+ args_schema --> "PydanticClassName",
75
+ description --> "Detailed prompt for the AI agent"
76
+ }
77
+ ```
78
+
79
+ ## πŸš€ Getting Started
80
+ 1. Project Structure
81
+ Keep your tools organized. We recommend an aion_tools/ directory for modularity.
82
+
83
+ ```text
84
+ from aions import AIONS
85
+ import api_functions
86
+ from schemas import SendLikeInput
87
+
88
+ # 1. Load your tools with context
89
+ # 'globals()' allows AIONS to find your imported functions and schemas in memory
90
+ tools = AIONS.get_langchain_tools(
91
+ source_path="aion_tools/",
92
+ context=globals()
93
+ )
94
+
95
+ # 2. Pass them directly to your Agent
96
+ # agent = initialize_agent(tools, llm, ...)
97
+ ```
98
+
99
+ ## 2. Integration with LangChain
100
+ AIONS is built to be a first-class citizen in the LangChain ecosystem.
101
+
102
+ ```text
103
+ from aions import AIONS
104
+ import api_functions
105
+ from schemas import SendLikeInput
106
+
107
+ # 1. Load your tools with context
108
+ # 'globals()' allows AIONS to find your imported functions and schemas
109
+ tools = AIONS.get_langchain_tools(
110
+ source_path="aion_tools/",
111
+ context=globals()
112
+ )
113
+
114
+ # 2. Pass them directly to your Agent
115
+ # agent = initialize_agent(tools, llm, ...)
116
+ ```
117
+
118
+ ## βš–οΈ Error Handling
119
+
120
+ AIONS is designed to fail fast. This prevents your AI Agent from attempting to use a tool that was configured incorrectly.
121
+
122
+ | Error | Cause |
123
+ | :--- | :--- |
124
+ | `AIONPropertyError` | Using an unauthorized key (e.g., using `desc` instead of `description`). |
125
+ | `AIONParseError` | Syntax errors, missing brackets, or function strings that don't exist in your Python code. |
126
+
127
+ ## πŸ›  Extending the Framework
128
+ The AIONS class provides several utility methods for different workflows:
129
+
130
+ ```text
131
+ load_dir(path, context): Automatically stitches together all .aion files in a folder.
132
+
133
+ dumps(list_of_tools): Converts existing Python tool dictionaries into the AIONS standard text format.
134
+
135
+ get_langchain_tools(...): The high-level factory for instant LangChain mounting.
136
+ ```
137
+ ## 🀝 Contributing
138
+ AIONS is an open standard. Feel free to fork the framework and add support for other LLM frameworks.
139
+
140
+ Developed by Sourav Modak
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "aions-llm"
7
+ version = "1.0.0"
8
+ authors = [
9
+ { name="Sourav Modak" },
10
+ ]
11
+ description = "Actions and Interface Object Notation: An open standard for LLM tools."
12
+ readme = "README.md"
13
+ requires-python = ">=3.8"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+ dependencies = [
20
+ "langchain>=0.1.0",
21
+ ]
22
+
23
+ [tool.setuptools.packages.find]
24
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ from .aions import AIONS, AIONParseError, AIONPropertyError
2
+
3
+ __all__ = ['AIONS', 'AIONParseError', 'AIONPropertyError']
@@ -0,0 +1,167 @@
1
+ import os
2
+ import re
3
+ from typing import Any, Dict, List
4
+
5
+
6
+ class AIONPropertyError(Exception):
7
+ """Raised when an unidentified property is found in the .aion file."""
8
+ pass
9
+
10
+
11
+ class AIONParseError(Exception):
12
+ """Raised when the syntax of the .aion file is invalid."""
13
+ pass
14
+
15
+
16
+ class AIONS:
17
+ # Expanded properties to include LangChain's args_schema
18
+ ALLOWED_PROPERTIES = {"name", "function", "description", "args_schema"}
19
+
20
+ @classmethod
21
+ def loads(cls, aion_text: str, context: Dict[str, Any] = None) -> List[Dict[str, Any]]:
22
+ aion_text = aion_text.strip()
23
+
24
+ if not (aion_text.startswith("[") and aion_text.endswith("]")):
25
+ raise AIONParseError("AION definition must be an array enclosed in [ ]")
26
+
27
+ tools = []
28
+ block_pattern = re.compile(r'\{([^{}]*\{[^{}]*\}[^{}]*|[^{}]*)\}')
29
+ blocks = block_pattern.findall(aion_text)
30
+
31
+ for block in blocks:
32
+ tool_data = {}
33
+ found_properties = re.findall(r'([a-zA-Z0-9_-]+)\s*-->', block)
34
+
35
+ for prop in set(found_properties):
36
+ if prop not in cls.ALLOWED_PROPERTIES and not prop.startswith("arg-") and not prop.startswith(
37
+ "return-"):
38
+ raise AIONPropertyError(f"Error: Property [{prop}] cannot be identified.")
39
+
40
+ # Extract Name
41
+ name_match = re.search(r'name\s*-->\s*"([^"]+)"', block)
42
+ if name_match:
43
+ tool_data['name'] = name_match.group(1)
44
+
45
+ # Extract Description
46
+ desc_match = re.search(r'description\s*-->\s*"([^"]+)"', block)
47
+ if desc_match:
48
+ tool_data['description'] = desc_match.group(1)
49
+
50
+ # Extract Args Schema (New Property)
51
+ schema_match = re.search(r'args_schema\s*-->\s*"([^"]+)"', block)
52
+ if schema_match:
53
+ schema_str = schema_match.group(1)
54
+ tool_data['args_schema_str'] = schema_str
55
+ if context:
56
+ try:
57
+ # Evaluate the string to get the actual Pydantic class
58
+ tool_data['args_schema'] = eval(schema_str, context)
59
+ except Exception as e:
60
+ raise AIONParseError(
61
+ f"Could not parse schema '{schema_str}'. Ensure it is in context. Error: {e}")
62
+
63
+ # Extract Function Block
64
+ func_match = re.search(r'function\s*-->\s*"([^"]+)"\s*-->\s*\{([^}]+)\}', block)
65
+ if func_match:
66
+ func_str = func_match.group(1)
67
+ inner_block = func_match.group(2)
68
+ func_data = {"raw_string": func_str, "args": {}, "returns": {}}
69
+
70
+ if context:
71
+ try:
72
+ func_data["executable"] = eval(func_str, context)
73
+ except Exception as e:
74
+ raise AIONParseError(
75
+ f"Could not parse function '{func_str}'. Ensure all dependencies are in context. Error: {e}")
76
+
77
+ inner_items = re.findall(r'(arg-\d+|return-\d+)\s*-->\s*"([^"]*)"', inner_block)
78
+ for key, val in inner_items:
79
+ if key.startswith("arg-"):
80
+ func_data["args"][key] = val
81
+ elif key.startswith("return-"):
82
+ func_data["returns"][key] = val
83
+
84
+ tool_data['function'] = func_data
85
+
86
+ tools.append(tool_data)
87
+
88
+ return tools
89
+
90
+ @classmethod
91
+ def load(cls, filepath: str, context: Dict[str, Any] = None) -> List[Dict[str, Any]]:
92
+ with open(filepath, 'r', encoding='utf-8') as f:
93
+ return cls.loads(f.read(), context)
94
+
95
+ @classmethod
96
+ def load_dir(cls, dirpath: str, context: Dict[str, Any] = None) -> List[Dict[str, Any]]:
97
+ all_tools = []
98
+ for filename in os.listdir(dirpath):
99
+ if filename.endswith(".aion"):
100
+ filepath = os.path.join(dirpath, filename)
101
+ all_tools.extend(cls.load(filepath, context))
102
+ return all_tools
103
+
104
+ @classmethod
105
+ def dumps(cls, tools: List[Dict[str, Any]]) -> str:
106
+ aion_strings = []
107
+ for tool in tools:
108
+ aion_str = " {\n"
109
+ aion_str += f' name --> "{tool.get("name", "")}",\n'
110
+
111
+ func = tool.get("function", {})
112
+ aion_str += f' function --> "{func.get("raw_string", "")}" --> {{\n'
113
+
114
+ for arg_k, arg_v in func.get("args", {}).items():
115
+ aion_str += f' {arg_k} --> "{arg_v}",\n'
116
+
117
+ for ret_k, ret_v in func.get("returns", {}).items():
118
+ aion_str += f' {ret_k} --> "{ret_v}",\n'
119
+
120
+ aion_str = aion_str.rstrip(",\n") + "\n },\n"
121
+
122
+ # Dump args_schema if it exists
123
+ if 'args_schema_str' in tool:
124
+ aion_str += f' args_schema --> "{tool["args_schema_str"]}",\n'
125
+
126
+ aion_str += f' description --> "{tool.get("description", "")}"\n'
127
+ aion_str += " }"
128
+ aion_strings.append(aion_str)
129
+
130
+ return "[\n" + ",\n".join(aion_strings) + "\n]"
131
+
132
+ @classmethod
133
+ def dump(cls, tools: List[Dict[str, Any]], filepath: str):
134
+ with open(filepath, 'w', encoding='utf-8') as f:
135
+ f.write(cls.dumps(tools))
136
+
137
+ @classmethod
138
+ def get_langchain_tools(cls, source_path: str, context: Dict[str, Any]) -> list:
139
+ try:
140
+ from langchain.agents import Tool
141
+ except ImportError:
142
+ raise ImportError("LangChain is not installed. Run 'pip install langchain'")
143
+
144
+ if os.path.isdir(source_path):
145
+ parsed_data = cls.load_dir(source_path, context)
146
+ elif os.path.isfile(source_path):
147
+ parsed_data = cls.load(source_path, context)
148
+ else:
149
+ raise FileNotFoundError(f"Source '{source_path}' is neither a valid file nor directory.")
150
+
151
+ langchain_tools = []
152
+ for tool_config in parsed_data:
153
+ tool_name = tool_config["name"]
154
+ executable_func = tool_config["function"]["executable"]
155
+
156
+ # Now extracting schema dynamically from the parsed AION data
157
+ args_schema = tool_config.get("args_schema")
158
+
159
+ tool = Tool(
160
+ name=tool_name,
161
+ func=executable_func,
162
+ description=tool_config["description"],
163
+ args_schema=args_schema
164
+ )
165
+ langchain_tools.append(tool)
166
+
167
+ return langchain_tools
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.4
2
+ Name: aions-llm
3
+ Version: 1.0.0
4
+ Summary: Actions and Interface Object Notation: An open standard for LLM tools.
5
+ Author: Sourav Modak
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: langchain>=0.1.0
12
+
13
+ # AIONS: Actions and Interface Object Notation
14
+
15
+ **AIONS** (pronounced *IONS*) is an open-standard, text-based data format designed specifically for AI Large Language Models (LLMs). It allows developers to decouple tool definitions from core logic, making AI "Actions" as portable as JSON but as powerful as native Python.
16
+
17
+ ## πŸ›  Why AIONS?
18
+
19
+ Traditional AI tool registration often involves bloating your Python files with massive strings for descriptions and repetitive boilerplate. AIONS solves this by:
20
+ * **Decoupling:** Move your LLM prompts (descriptions) and tool mappings into external `.aion` files.
21
+ * **Dynamic Evaluation:** Supports native Python lambdas and complex logic directly within the notation.
22
+ * **Strict Validation:** Enforces a rigid property schema to prevent "ghost tools" or broken agent execution.
23
+ * **Zero-Map Architecture:** No need to maintain manual dictionaries; if it’s in the `.aion` file, it’s in your Agent.
24
+
25
+ ---
26
+
27
+ ## πŸ“œ The Laws of AIONS
28
+
29
+ To maintain the "Open Standard" integrity, every `.aion` file must adhere to the following rules:
30
+
31
+ ### 1. The Array Constraint
32
+ An AIONS definition must always be an array, enclosed in square brackets `[ ]`. Even if you are defining a single tool, it must reside within an array.
33
+
34
+ ### 2. The Arrow Operator
35
+ Properties are assigned using the "Action-Link" operator: `-->`.
36
+ * **Valid:** `name --> "MyTool"`
37
+ * **Invalid:** `name: "MyTool"` or `name = "MyTool"`
38
+
39
+ ### 3. Property Isolation
40
+ AIONS strictly enforces identified properties. If the parser encounters a top-level key that is not in the **Approved Registry**, it will throw an `AIONPropertyError`.
41
+ * **Approved Registry:** `name`, `function`, `description`, `args_schema`.
42
+
43
+ ### 4. The Function Block
44
+ The `function` property is a "Smart Property." It requires a raw string representing the executable (lambda or function name) followed by an "Interface Block" `{ }` describing the inputs and outputs.
45
+ * Inputs must follow the `arg-N` pattern.
46
+ * Outputs must follow the `return-N` pattern.
47
+
48
+ ---
49
+
50
+ ## πŸ“‚ Syntax Example
51
+ ### πŸ“ AIONS Syntax Guide
52
+
53
+ The AIONS (Actions and Interface Object Notation) syntax is designed to be strictly structural yet human-readable. It follows a specific set of rules to ensure LLM compatibility and execution safety.
54
+
55
+ #### 1. Global Wrapper
56
+ All tool definitions must be contained within a root-level array:
57
+ `[` ... `]`
58
+
59
+ #### 2. Tool Objects
60
+ Individual tools are defined as objects within curly braces:
61
+ `{` ... `}`
62
+
63
+ #### 3. The Action-Link Operator (-->)
64
+ AIONS uses the `-->` operator to map keys to values. Standard colon `:` or equals `=` assignments are invalid and will trigger a parse error.
65
+
66
+ #### 4. Top-Level Properties
67
+ Every tool object must contain the following identified properties:
68
+ * **name**: The unique identifier for the tool.
69
+ * **function**: The executable logic and interface mapping.
70
+ * **args_schema** (Optional): The Pydantic class name for input validation.
71
+ * **description**: The natural language instruction for the LLM.
72
+
73
+ #### 5. The Smart Function Block
74
+ The `function` property is split into two parts:
75
+ 1. **Executable String**: The lambda or function name (e.g., `"lambda x: func(x)"`).
76
+ 2. **Interface Block**: A nested `{}` mapping that defines parameters and returns.
77
+
78
+ #### πŸ’‘ Syntax Template:
79
+ ```text
80
+ {
81
+ name --> "Unique_Tool_Name",
82
+ function --> "executable_python_logic" --> {
83
+ arg-1 --> "Input description",
84
+ return-1 --> "Output description"
85
+ },
86
+ args_schema --> "PydanticClassName",
87
+ description --> "Detailed prompt for the AI agent"
88
+ }
89
+ ```
90
+
91
+ ## πŸš€ Getting Started
92
+ 1. Project Structure
93
+ Keep your tools organized. We recommend an aion_tools/ directory for modularity.
94
+
95
+ ```text
96
+ from aions import AIONS
97
+ import api_functions
98
+ from schemas import SendLikeInput
99
+
100
+ # 1. Load your tools with context
101
+ # 'globals()' allows AIONS to find your imported functions and schemas in memory
102
+ tools = AIONS.get_langchain_tools(
103
+ source_path="aion_tools/",
104
+ context=globals()
105
+ )
106
+
107
+ # 2. Pass them directly to your Agent
108
+ # agent = initialize_agent(tools, llm, ...)
109
+ ```
110
+
111
+ ## 2. Integration with LangChain
112
+ AIONS is built to be a first-class citizen in the LangChain ecosystem.
113
+
114
+ ```text
115
+ from aions import AIONS
116
+ import api_functions
117
+ from schemas import SendLikeInput
118
+
119
+ # 1. Load your tools with context
120
+ # 'globals()' allows AIONS to find your imported functions and schemas
121
+ tools = AIONS.get_langchain_tools(
122
+ source_path="aion_tools/",
123
+ context=globals()
124
+ )
125
+
126
+ # 2. Pass them directly to your Agent
127
+ # agent = initialize_agent(tools, llm, ...)
128
+ ```
129
+
130
+ ## βš–οΈ Error Handling
131
+
132
+ AIONS is designed to fail fast. This prevents your AI Agent from attempting to use a tool that was configured incorrectly.
133
+
134
+ | Error | Cause |
135
+ | :--- | :--- |
136
+ | `AIONPropertyError` | Using an unauthorized key (e.g., using `desc` instead of `description`). |
137
+ | `AIONParseError` | Syntax errors, missing brackets, or function strings that don't exist in your Python code. |
138
+
139
+ ## πŸ›  Extending the Framework
140
+ The AIONS class provides several utility methods for different workflows:
141
+
142
+ ```text
143
+ load_dir(path, context): Automatically stitches together all .aion files in a folder.
144
+
145
+ dumps(list_of_tools): Converts existing Python tool dictionaries into the AIONS standard text format.
146
+
147
+ get_langchain_tools(...): The high-level factory for instant LangChain mounting.
148
+ ```
149
+ ## 🀝 Contributing
150
+ AIONS is an open standard. Feel free to fork the framework and add support for other LLM frameworks.
151
+
152
+ Developed by Sourav Modak
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/aions/__init__.py
4
+ src/aions/aions.py
5
+ src/aions_llm.egg-info/PKG-INFO
6
+ src/aions_llm.egg-info/SOURCES.txt
7
+ src/aions_llm.egg-info/dependency_links.txt
8
+ src/aions_llm.egg-info/requires.txt
9
+ src/aions_llm.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ langchain>=0.1.0