File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff line change 11import asyncio
2+ import sys
23from 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" ,
Original file line number Diff line number Diff 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 ,
You can’t perform that action at this time.
0 commit comments