(prompt, har_file_path="network_requests.har", cookie_path="cookies.json", to_generate_code=False)
| 20 | |
| 21 | |
| 22 | def build_graph(prompt, har_file_path="network_requests.har", cookie_path="cookies.json", to_generate_code=False): |
| 23 | agent = IntegrationAgent(prompt, har_file_path, cookie_path) |
| 24 | |
| 25 | graph_builder = StateGraph(AgentState) |
| 26 | |
| 27 | # Add nodes using the agent's methods |
| 28 | graph_builder.add_node("IntegrationAgent", agent.end_url_identify_agent) |
| 29 | graph_builder.set_entry_point("IntegrationAgent") |
| 30 | |
| 31 | graph_builder.add_node("urlTocurl", agent.url_to_curl) |
| 32 | graph_builder.add_edge("IntegrationAgent", "urlTocurl") |
| 33 | |
| 34 | graph_builder.add_node( |
| 35 | "dynamicurlDataIdentifyingAgent", agent.dynamic_part_identifying_agent |
| 36 | ) |
| 37 | graph_builder.add_edge("urlTocurl", "dynamicurlDataIdentifyingAgent") |
| 38 | |
| 39 | graph_builder.add_node("inputVariablesIdentifyingAgent", agent.input_variables_identifying_agent) |
| 40 | graph_builder.add_edge("dynamicurlDataIdentifyingAgent", "inputVariablesIdentifyingAgent") |
| 41 | |
| 42 | graph_builder.add_node("findcurlFromContent", agent.find_curl_from_content) |
| 43 | graph_builder.add_edge("inputVariablesIdentifyingAgent", "findcurlFromContent") |
| 44 | |
| 45 | # Add conditional edges |
| 46 | graph_builder.add_conditional_edges( |
| 47 | "findcurlFromContent", |
| 48 | partial(check_end_condition, agent=agent, to_generate_code=to_generate_code), |
| 49 | {"end": END, "continue": "dynamicurlDataIdentifyingAgent"}, |
| 50 | ) |
| 51 | |
| 52 | graph = graph_builder.compile() |
| 53 | return graph, agent |
no test coverage detected