We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 55ca672 commit bfb934dCopy full SHA for bfb934d
wren-ai-service/src/web/v1/services/ask.py
@@ -15,6 +15,7 @@
15
16
class AskHistory(BaseModel):
17
response: str = Field(alias=AliasChoices("response", "sql"))
18
+ type: Literal["text", "sql"] = "sql"
19
question: str
20
21
@@ -257,10 +258,12 @@ async def ask(
257
258
if self._allow_intent_classification:
259
last_sql_data = None
260
if histories:
- if last_sql := histories[-1].response:
261
+ if (last_response := histories[-1].response) and histories[
262
+ -1
263
+ ].type == "sql":
264
last_sql_data = (
265
await self._pipelines["sql_executor"].run(
- sql=last_sql,
266
+ sql=last_response,
267
project_id=ask_request.project_id,
268
)
269
)["execute_sql"]["results"]
0 commit comments