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

feat: add search text-sql pair in cached table #60

Merged
merged 2 commits into from
Apr 2, 2024

Conversation

jitingxu1
Copy link
Collaborator

@jitingxu1 jitingxu1 commented Mar 24, 2024

Related issue: #46

Search question to check if it is in the cached table.

  • pass a cached Table
    • schema: question, sql, dialect
  • create a search-text-task
  • search question before generating sql by LLM

ADDED

from ibis_birdbrain.bot import Bot
import ibis
ibis.options.interactive = True

con = ibis.duckdb.connect()
t = ibis.read_parquet("m.parquet")
con.create_table("mortgage", t.to_pyarrow())


questions = [
    {
        "question": "how many rows in the table",
        "sql": "select count(*) from mortgage",
        "dialect": "duckdb",
    },
    {
        "question": "top 10 rows in the table",
        "sql": "select * from mortgage limit 10",
        "dialect": "duckdb",
    },
]
cached_table = ibis.memtable(questions)
bot = Bot(con=con, cached_table=cached_table)

bot("top 10 rows in the table")

Copy link

@drabastomek drabastomek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small things. The rest LGTM.

src/ibis_birdbrain/bot.py Outdated Show resolved Hide resolved
src/ibis_birdbrain/flows/data.py Outdated Show resolved Hide resolved
src/ibis_birdbrain/tasks/sql.py Outdated Show resolved Hide resolved
@lostmygithubaccount
Copy link
Member

merging, thanks!

@lostmygithubaccount lostmygithubaccount merged commit 952ae12 into ibis-project:main Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants