Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Commit

Permalink
make data table output configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
dloman118 committed Jan 5, 2024
1 parent dbf528b commit 873b3ab
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/openassistants/openassistants/contrib/sqlalchemy_query.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import abc
import asyncio
from typing import Annotated, Any, List, Literal, Sequence
from typing import Annotated, Any, List, Literal, Optional, Sequence

import jsonschema
import pandas as pd
Expand Down Expand Up @@ -77,6 +77,7 @@ class QueryFunction(BaseFunction, abc.ABC):
sqls: List[str]
visualizations: List[str]
summarization: str
data_table_output: Optional[bool] = True
suggested_follow_ups: Annotated[List[SuggestedPrompt], Field(default_factory=list)]

@abc.abstractmethod
Expand Down Expand Up @@ -159,14 +160,15 @@ async def execute(
results: List[FunctionOutput] = []

dataframes = await self._execute_sqls(deps)
results.extend(
[
DataFrameOutput(dataframe=SerializedDataFrame.from_pd(df))
for df in dataframes
]
)
if self.data_table_output:
results.extend(
[
DataFrameOutput(dataframe=SerializedDataFrame.from_pd(df))
for df in dataframes
]
)

yield results
yield results

visualizations = await self._execute_visualizations(dataframes, deps)

Expand Down

0 comments on commit 873b3ab

Please sign in to comment.