From dd47a76b616cd742acfce3e8710bef94c2658b8e Mon Sep 17 00:00:00 2001 From: parkervg Date: Thu, 22 Feb 2024 11:50:01 -0500 Subject: [PATCH] Documentation, __version__ to 0.0.11 --- blendsql/blendsql.py | 4 +++- blendsql/db/sqlite_db_connector.py | 11 +++-------- blendsql/llms/remote/_openai.py | 1 + docs/index.md | 4 ++++ docs/reference/blenders/blenders.md | 2 +- docs/reference/{ => databases}/databases.md | 0 docs/reference/databases/sqlite.md | 5 +++++ mkdocs.yml | 13 +++++++++---- 8 files changed, 26 insertions(+), 14 deletions(-) rename docs/reference/{ => databases}/databases.md (100%) create mode 100644 docs/reference/databases/sqlite.md diff --git a/blendsql/blendsql.py b/blendsql/blendsql.py index 97fb6ed6..4c5ec96c 100644 --- a/blendsql/blendsql.py +++ b/blendsql/blendsql.py @@ -283,7 +283,8 @@ def blend( _prev_passed_values: int = 0, _prev_cleanup_tables: Set[str] = None, ) -> Smoothie: - """Executes a BlendSQL query on a database given an ingredient context. + """The `blend()` function is used to execute a BlendSQL query against a database and return the final result, in addition to the intermediate reasoning steps taken. + Execution is done on a database given an ingredient context. Args: query: The BlendSQL query to execute @@ -298,6 +299,7 @@ def blend( and put this in the `example_outputs` kwarg table_to_title: Optional mapping from table name to title of table. Useful for datasets like WikiTableQuestions, where relevant info is stored in table title. + Returns: smoothie: Smoothie dataclass containing pd.DataFrame output and execution metadata """ diff --git a/blendsql/db/sqlite_db_connector.py b/blendsql/db/sqlite_db_connector.py index 6242938d..8ab44a15 100644 --- a/blendsql/db/sqlite_db_connector.py +++ b/blendsql/db/sqlite_db_connector.py @@ -18,15 +18,10 @@ @attrs(auto_detect=True) class SQLiteDBConnector: """ - Method to connect to db which also has some utility ingredients. + Class used to connect to a SQLite database. - Parameter - --------- - path : str - Path of the db - - db : str - File name of the db + Args: + db_path: Path to the db """ db_path: str = attrib() diff --git a/blendsql/llms/remote/_openai.py b/blendsql/llms/remote/_openai.py index f8f957a3..8a08a256 100644 --- a/blendsql/llms/remote/_openai.py +++ b/blendsql/llms/remote/_openai.py @@ -70,6 +70,7 @@ def _load_model(self) -> Model: self.model_name_or_path, api_key=os.getenv("OPENAI_API_KEY"), azure_endpoint=os.getenv("OPENAI_API_BASE"), + azure_deployment=os.getenv("API_VERSION"), echo=False, ) diff --git a/docs/index.md b/docs/index.md index 098230c6..f43acdd7 100644 --- a/docs/index.md +++ b/docs/index.md @@ -18,6 +18,10 @@ hide:
+```bash +pip install blendsql +``` + BlendSQL is a *superset of SQLite* for problem decomposition and hybrid question-answering with LLMs. It builds off of the syntax of SQL to create an intermediate representation for tasks requiring complex reasoning over both structured and unstructured data. It can be viewed as an inversion of the typical text-to-SQL paradigm, where a user calls a LLM, and the LLM calls a SQL program. diff --git a/docs/reference/blenders/blenders.md b/docs/reference/blenders/blenders.md index 93a48144..46e1dbdb 100644 --- a/docs/reference/blenders/blenders.md +++ b/docs/reference/blenders/blenders.md @@ -2,7 +2,7 @@ We use the term "blender" to describe the LLM which receives the prompts used to perform each ingredient function within a BlendSQL script. -We enable integration with many existing LLMs by building on top of `guidance` models: https://github.com/guidance-ai/guidance?tab=readme-ov-file#loading-models +We enable integration with many existing LLMs by building on top of [`guidance` models](https://github.com/guidance-ai/guidance?tab=readme-ov-file#loading-models). Certain models may be better geared towards some BlendSQL tasks than others, so choose carefully! diff --git a/docs/reference/databases.md b/docs/reference/databases/databases.md similarity index 100% rename from docs/reference/databases.md rename to docs/reference/databases/databases.md diff --git a/docs/reference/databases/sqlite.md b/docs/reference/databases/sqlite.md new file mode 100644 index 00000000..0d54c67b --- /dev/null +++ b/docs/reference/databases/sqlite.md @@ -0,0 +1,5 @@ +# SQLite + +::: blendsql.db.sqlite_db_connector.SQLiteDBConnector + handler: python + show_source: true \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 0bf2f664..b59e74dd 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -35,20 +35,24 @@ plugins: python: options: show_submodules: true + show_source: true + docstring_style: google + docstring_section_style: table + show_docstring_examples: true + show_symbol_type_heading: true - search - section-index nav: - Home: - - index.md + - Home: index.md - Examples from QA Datasets: - HybridQA: examples/hybridqa.md - OTT-QA: examples/ottqa.md - FEVEROUS: examples/feverous.md + - FAQ: faq.md - Getting Started: - - Installation: installation.md - Quickstart: quickstart.md - - FAQ: faq.md - Documentation: - Execute a BlendSQL Query: reference/execute-blendsql.md - Ingredients: @@ -60,5 +64,6 @@ nav: - reference/blenders/blenders.md - OpenAI: reference/blenders/openai.md - Transformers: reference/blenders/transformers.md - - Databases: reference/databases.md + - Databases: + - SQLite: reference/databases/sqlite.md - Technical Walkthrough: reference/technical_walkthrough.md