Skip to content

Commit 69bba26

Browse files
committed
feat: Vector retrieval matches tables
1 parent ee1c0c0 commit 69bba26

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

backend/apps/chat/api/chat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ async def stream_sql(session: SessionDep, current_user: CurrentUser, request_que
145145
"""
146146

147147
try:
148-
llm_service = await LLMService.create(current_user, request_question, current_assistant)
148+
llm_service = await LLMService.create(current_user, request_question, current_assistant, embedding=True)
149149
llm_service.init_record()
150150
llm_service.run_task_async()
151151
except Exception as e:

backend/apps/chat/task/llm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class LLMService:
8585

8686
def __init__(self, current_user: CurrentUser, chat_question: ChatQuestion,
8787
current_assistant: Optional[CurrentAssistant] = None, no_reasoning: bool = False,
88-
config: LLMConfig = None):
88+
embedding: bool = False, config: LLMConfig = None):
8989
self.chunk_list = []
9090
# engine = create_engine(str(settings.SQLALCHEMY_DATABASE_URI))
9191
# session_maker = sessionmaker(bind=engine)
@@ -115,7 +115,7 @@ def __init__(self, current_user: CurrentUser, chat_question: ChatQuestion,
115115
raise SingleMessageError("No available datasource configuration found")
116116
chat_question.engine = (ds.type_name if ds.type != 'excel' else 'PostgreSQL') + get_version(ds)
117117
chat_question.db_schema = get_table_schema(session=self.session, current_user=current_user, ds=ds,
118-
question=chat_question.question)
118+
question=chat_question.question, embedding=embedding)
119119

120120
self.generate_sql_logs = list_generate_sql_logs(session=self.session, chart_id=chat_id)
121121
self.generate_chart_logs = list_generate_chart_logs(session=self.session, chart_id=chat_id)

0 commit comments

Comments
 (0)