public CompiledGraph<State> buildGraph() throws Exception {
        return new StateGraph<>(State::new)
            // Define the nodes
            .addNode("web_search", node_async(this::webSearch) )  // web search
            .addNode("retrieve", node_async(this::retrieve) )  // retrieve
            .addNode("grade_documents",  node_async(this::gradeDocuments) )  // grade documents
            .addNode("generate", node_async(this::generate) )  // generatae
            .addNode("transform_query", node_async(this::transformQuery))  // transform_query
            // Build graph
            .addConditionalEdges(START,
                    edge_async(this::routeQuestion),
                    mapOf(
                        "web_search", "web_search",
                        "vectorstore", "retrieve"
                    ))

            .addEdge("web_search", "generate")
            .addEdge("retrieve", "grade_documents")
            .addConditionalEdges(
                    "grade_documents",
                    edge_async(this::decideToGenerate),
                    mapOf(
                        "transform_query","transform_query",
                        "generate", "generate"
                    ))
            .addEdge("transform_query", "retrieve")
            .addConditionalEdges(
                    "generate",
                    edge_async(this::gradeGeneration_v_documentsAndQuestion),
                    mapOf(
                            "not supported", "generate",
                            "useful", END,
                            "not useful", "transform_query"
                    ))
             .compile();
    }
@Test
    public void getGraphTest() throws Exception {

        AdaptiveRag adaptiveRag = new AdaptiveRag(getOpenAiKey(), getTavilyApiKey());

        var graph = adaptiveRag.buildGraph();

        var plantUml = graph.getGraph( GraphRepresentation.Type.PLANTUML, "Adaptive RAG" );

        System.out.println( plantUml.getContent() );

        var mermaid = graph.getGraph( GraphRepresentation.Type.MERMAID, "Adaptive RAG" );

        System.out.println( mermaid.getContent() );
    }