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 False
Browse files Browse the repository at this point in the history
  • Loading branch information
dloman118 committed Jan 5, 2024
1 parent 5c77e9b commit dc21612
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions examples/fast-api-server/library/nba/game_recap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ parameters:
- team
type: DuckDBQueryFunction
dataset: 'dummy-data/'
data_table_output: False
sqls:
- |
SELECT date,home_team,away_team,home_team_abbr,away_team_abbr,home_team_winner,away_team_winner,home_team_score,away_team_score,venue,location,home_team_overall_record,away_team_overall_record,
Expand Down
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, Sequence, Optional

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 dc21612

Please sign in to comment.