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

Fix: Fix typo in ai_assistant constants DEFAUTL -> DEFAULT #1508

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions querybook/server/const/ai_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ class AICommandType(Enum):
# how many docs to fetch from vector store, it may include both table and query summary docs and they need additional processing.
DEFAULT_VECTOR_STORE_FETCH_LIMIT = 30
# how many tables to return from vector table search eventually
DEFAUTL_TABLE_SEARCH_LIMIT = 10
DEFAULT_TABLE_SEARCH_LIMIT = 10
# how many tables to select for text-to-sql
DEFAUTL_TABLE_SELECT_LIMIT = 3
DEFAULT_TABLE_SELECT_LIMIT = 3
6 changes: 3 additions & 3 deletions querybook/server/lib/ai_assistant/base_ai_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from app.db import with_session
from const.ai_assistant import (
DEFAUTL_TABLE_SELECT_LIMIT,
DEFAULT_TABLE_SELECT_LIMIT,
MAX_SAMPLE_QUERY_COUNT_FOR_TABLE_SUMMARY,
AICommandType,
)
Expand Down Expand Up @@ -403,7 +403,7 @@ def summarize_query(
def find_tables(self, metastore_id, question, session=None):
"""Search similar tables from vector store first, and then ask LLM to select most suitable tables for the question.

It will return at most `DEFAUTL_TABLE_SELECT_LIMIT` tables by default.
It will return at most `DEFAULT_TABLE_SELECT_LIMIT` tables by default.
"""
try:
tables = get_vector_store().search_tables(
Expand Down Expand Up @@ -443,7 +443,7 @@ def find_tables(self, metastore_id, question, session=None):
table_docs[full_table_name] = summary

prompt = self._get_table_select_prompt(
top_n=DEFAUTL_TABLE_SELECT_LIMIT,
top_n=DEFAULT_TABLE_SELECT_LIMIT,
table_schemas=table_docs,
question=question,
)
Expand Down
4 changes: 2 additions & 2 deletions querybook/server/lib/vector_store/base_vector_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Literal, Optional

from const.ai_assistant import (
DEFAUTL_TABLE_SEARCH_LIMIT,
DEFAULT_TABLE_SEARCH_LIMIT,
DEFAULT_VECTOR_STORE_FETCH_LIMIT,
DEFAULT_SIMILARITY_SCORE_THRESHOLD,
DEFAULT_SIMILARITY_SCORE_THRESHOLD_GREAT_MATCH,
Expand Down Expand Up @@ -60,7 +60,7 @@ def search_tables(
text: str,
search_type: Optional[Literal["table", "query"]] = None,
threshold=DEFAULT_SIMILARITY_SCORE_THRESHOLD,
k=DEFAUTL_TABLE_SEARCH_LIMIT,
k=DEFAULT_TABLE_SEARCH_LIMIT,
fetch_k=DEFAULT_VECTOR_STORE_FETCH_LIMIT,
) -> list[tuple[str, int]]:
"""Find tables using embedding based table search.
Expand Down
4 changes: 2 additions & 2 deletions querybook/server/logic/vector_store.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from app.db import with_session
from const.ai_assistant import (
DEFAUTL_TABLE_SEARCH_LIMIT,
DEFAULT_TABLE_SEARCH_LIMIT,
MAX_SAMPLE_QUERY_COUNT_FOR_TABLE_SUMMARY,
)
from langchain.docstore.document import Document
Expand Down Expand Up @@ -154,7 +154,7 @@ def delete_table_doc(table_id: int):


def search_tables(
metastore_id, keywords, filters=None, limit=DEFAUTL_TABLE_SEARCH_LIMIT
metastore_id, keywords, filters=None, limit=DEFAULT_TABLE_SEARCH_LIMIT
):
"""search tables from vector store and get the table details from elastic search."""

Expand Down
Loading