MCPcopy Index your code
hub / github.com/Integuru-AI/Integuru / input_variables_identifying_agent

Method input_variables_identifying_agent

integuru/agent.py:76–144  ·  view source on GitHub ↗

Identify input variables present in the cURL command

(self, state: AgentState)

Source from the content-addressed store, hash-verified

74 return state
75
76 def input_variables_identifying_agent(self, state: AgentState) -> AgentState:
77 """
78 Identify input variables present in the cURL command
79 """
80 in_process_node_id = state[self.IN_PROCESS_NODE_KEY]
81 curl = self.dag_manager.graph.nodes[in_process_node_id]["content"]["key"].to_curl_command()
82 input_variables = state[self.INPUT_VARIABLES_KEY]
83 if not input_variables:
84 return state
85
86 function_def = {
87 "name": "identify_input_variables",
88 "description": "Identify input variables present in the cURL command.",
89 "parameters": {
90 "type": "object",
91 "properties": {
92 "identified_variables": {
93 "type": "array",
94 "items": {
95 "type": "object",
96 "properties": {
97 "variable_name": {"type": "string", "description": "The original key of the variable"},
98 "variable_value": {"type": "string", "description": "The exact version of the variable that is present in the cURL command. This should closely match the value in the provided Input Variables."}
99 },
100 "required": ["variable_name", "variable_value"]
101 },
102 "description": "A list of identified variables and their values."
103 }
104 },
105 "required": ["identified_variables"]
106 }
107 }
108
109
110 prompt = f"""
111 cURL: {curl}
112 Input Variables: {input_variables}
113
114 Task:
115 Identify which input variables (the value in the key-value pair) from the Input Variables provided above are present in the cURL command.
116
117 Important:
118 - If an input variable is found in the cURL, include it in the output.
119 - Do not include variables that are not provided above.
120 - The key of the input variable is a description of the variable.
121 - The value is the value that should closely match the value in the cURL command. No substitutions.
122
123 """
124
125
126 response = llm.get_instance().invoke(
127 prompt,
128 functions=[function_def],
129 function_call={"name": "identify_input_variables"}
130 )
131
132 function_call = response.additional_kwargs.get('function_call', {})
133 arguments = json.loads(function_call.get('arguments', '{}'))

Calls 3

to_curl_commandMethod · 0.80
get_instanceMethod · 0.80
update_nodeMethod · 0.80