From cd11be939e6955341de701228cd0d6d52e944ed5 Mon Sep 17 00:00:00 2001 From: "J.C. Zhong" Date: Wed, 10 Apr 2024 22:20:34 -0700 Subject: [PATCH] fix: use match_phrase_prefix on full_name field for table suggestion (#1433) * fix: use match_phrase_prefix on full_name field for table suggestion * add gpt-4-turbo contextsize --- .../server/lib/ai_assistant/assistants/openai_assistant.py | 1 + querybook/server/lib/elasticsearch/suggest_table.py | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/querybook/server/lib/ai_assistant/assistants/openai_assistant.py b/querybook/server/lib/ai_assistant/assistants/openai_assistant.py index 2ae7ff7be..6d9369768 100644 --- a/querybook/server/lib/ai_assistant/assistants/openai_assistant.py +++ b/querybook/server/lib/ai_assistant/assistants/openai_assistant.py @@ -13,6 +13,7 @@ "gpt-3.5-turbo-16k": 16385, "gpt-4": 8192, "gpt-4-32k": 32768, + "gpt-4-turbo": 128000, } DEFAULT_MODEL_NAME = "gpt-3.5-turbo" diff --git a/querybook/server/lib/elasticsearch/suggest_table.py b/querybook/server/lib/elasticsearch/suggest_table.py index eed2f14ff..d696149a1 100644 --- a/querybook/server/lib/elasticsearch/suggest_table.py +++ b/querybook/server/lib/elasticsearch/suggest_table.py @@ -8,9 +8,7 @@ def construct_suggest_table_query( "size": limit, "query": { "bool": { - "must": { - "match": {"full_name_ngram": {"query": keyword, "operator": "and"}} - }, + "must": [{"match_phrase_prefix": {"full_name": {"query": keyword}}}], "filter": {"match": {"metastore_id": metastore_id}}, } },