Skip to content

Commit a622b6c

Browse files
committed
fixes
1 parent 2af4004 commit a622b6c

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/toolguard/buildtime/gen_py/mellea_simple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self, llm: I_TG_LLM):
1616
self.llm = llm
1717
self.formatter = TemplateFormatter(model_id="")
1818

19-
async def generate_from_context(
19+
async def _generate_from_context(
2020
self,
2121
action: Component | CBlock,
2222
ctx: Context,

src/toolguard/buildtime/utils/datamodel_codegen.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
import sys
23
from pathlib import Path
34

45

@@ -16,7 +17,9 @@ async def run(oas_file: Path) -> str:
1617
"""
1718
# see https://github.com/koxudaxi/datamodel-code-generator
1819
process = await asyncio.create_subprocess_exec(
19-
"datamodel-codegen",
20+
sys.executable, # = Python executable
21+
"-m",
22+
"datamodel_code_generator",
2023
"--use-field-description",
2124
"--use-schema-description",
2225
"--output-model-type",

src/toolguard/extra/langchain_to_oas.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ def langchain_tools_to_openapi(
2727
for tool in tools:
2828
# Get JSON schema from the args model
2929
if tool.get_input_schema():
30-
components["schemas"][tool.name + "Args"] = (
31-
tool.get_input_schema().model_json_schema()
32-
)
30+
in_schema = tool.get_input_schema().model_json_schema()
31+
in_schema = substitute_refs(in_schema)
32+
in_schema.pop("$defs", None)
33+
components["schemas"][tool.name + "Args"] = in_schema
3334

3435
request_body = {
3536
"description": tool.description,

0 commit comments

Comments
 (0)