Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support Flink SQL Agent #56

Closed
HamaWhiteGG opened this issue Jul 23, 2023 · 1 comment
Closed

[Feature] Support Flink SQL Agent #56

HamaWhiteGG opened this issue Jul 23, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@HamaWhiteGG
Copy link
Owner

Similar to Spark SQL Agent,
visit https://python.langchain.com/docs/modules/agents/toolkits/spark_sql for more details.

HamaWhiteGG added a commit that referenced this issue Jul 23, 2023
@HamaWhiteGG HamaWhiteGG self-assigned this Jul 23, 2023
@HamaWhiteGG HamaWhiteGG added the enhancement New feature or request label Jul 23, 2023
@HamaWhiteGG
Copy link
Owner Author

I have implemented a local version FlinkSqlToolkitTest.

@Test
void testRunQuery() {
    var flinkSql = FlinkSql.builder()
            .tableEnv(tableEnv)
            .build()
            .init();

    var llm = ChatOpenAI.builder()
            .temperature(0)
            .build().init();

    var toolkit = new FlinkSqlToolkit(flinkSql, llm);
    var agentExecutor = createFlinkSqlAgent(llm, toolkit);

    // SELECT SQRT(AVG(Age)) FROM titanic
    var actual = agentExecutor.run("whats the square root of the average age?");
    // sometimes it's 'The square root of the average age is approximately 5.07.'
    assertEquals("5.07", actual);

    // TODO: It should be DESC here, not ASC.
    // SELECT Name FROM titanic WHERE Survived = 1 ORDER BY Age ASC LIMIT 1
    actual = agentExecutor.run("What's the name of the oldest survived passenger?");
    assertEquals("Sandstrom, Miss. Marguerite Rut", actual);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant