(self, lang: str)
| 100 | ) |
| 101 | |
| 102 | def to_dict(self, lang: str): |
| 103 | from app.services.tool import i18n_text |
| 104 | |
| 105 | input_schema_dict = { |
| 106 | k: { |
| 107 | "type": v.type, |
| 108 | "name": i18n_text(self.bundle_id, v.name, lang), |
| 109 | "description": i18n_text(self.bundle_id, v.description, lang), |
| 110 | "required": v.required, |
| 111 | } |
| 112 | for k, v in self.input_schema.items() |
| 113 | } |
| 114 | |
| 115 | output_schema_dict = { |
| 116 | k: { |
| 117 | "type": v.type, |
| 118 | "name": i18n_text(self.bundle_id, v.name, lang), |
| 119 | "description": i18n_text(self.bundle_id, v.description, lang), |
| 120 | "required": v.required, |
| 121 | } |
| 122 | for k, v in self.output_schema.items() |
| 123 | } |
| 124 | |
| 125 | return { |
| 126 | "object": self.object_name(), |
| 127 | "bundle_id": self.bundle_id, |
| 128 | "plugin_id": self.plugin_id, |
| 129 | "name": i18n_text(self.bundle_id, self.name, lang), |
| 130 | "description": i18n_text(self.bundle_id, self.description, lang), |
| 131 | "input_schema": input_schema_dict, |
| 132 | "output_schema": output_schema_dict, |
| 133 | "function_def": self.function_def, |
| 134 | } |
| 135 | |
| 136 | def validate_input(self, input_params: Dict[str, Any]): |
| 137 | # Iterate over the input_schema to validate each parameter |
nothing calls this directly
no test coverage detected