Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into chart-display
Browse files Browse the repository at this point in the history
  • Loading branch information
bx-h committed Oct 18, 2023
2 parents c62d95f + a2b927a commit 5bfcc87
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lida/components/summarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def get_column_properties(self, df: pd.DataFrame, n_samples: int = 3) -> list[di

return properties_list

def encrich(self, base_summary: dict, text_gen: TextGenerator,
def enrich(self, base_summary: dict, text_gen: TextGenerator,
textgen_config: TextGenerationConfig) -> dict:
"""Enrich the data summary with descriptions"""
logger.info(f"Enriching the data summary with descriptions")
Expand Down Expand Up @@ -138,7 +138,7 @@ def summarize(

if summary_method == "llm":
# two stage summarization with llm enrichment
data_summary = self.encrich(
data_summary = self.enrich(
base_summary,
text_gen=text_gen,
textgen_config=textgen_config)
Expand Down
9 changes: 9 additions & 0 deletions lida/datamodel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# from dataclasses import dataclass
import base64
from dataclasses import field
from typing import Any, Dict, List, Optional, Union

Expand Down Expand Up @@ -204,6 +205,14 @@ def _repr_mimebundle_(self, include=None, exclude=None):

return bundle

def savefig(self, path):
"""Save the raster image to a specified path if it exists"""
if self.raster:
with open(path, 'wb') as f:
f.write(base64.b64decode(self.raster))
else:
raise FileNotFoundError("No raster image to save")


@dataclass
class SummaryUrlRequest:
Expand Down
2 changes: 1 addition & 1 deletion lida/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "0.0.9"
VERSION = "0.0.10"
19 changes: 18 additions & 1 deletion notebooks/tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"text_gen = llm(\"palm\") # for palm\n",
"text_gen = llm(provider=\"hf\", model=\"uukuguy/speechless-llama2-hermes-orca-platypus-13b\", device_map=\"auto\")\n",
"\n",
"lida = Manager(llm=text_gen)\n",
"lida = Manager(text_gen=text_gen)\n",
"```\n",
"\n",
"Note that you can set your llm keys as follows\n",
Expand All @@ -57,6 +57,23 @@
"export PALM_SERVICE_ACCOUNT_KEY_FILE=<path to gcp service account key file>\n",
"export PALM_PROJECT_ID=<your gcp project id>\n",
"```\n",
"#### Azure OpenAI\n",
"```python\n",
"from llmx.generators.text.openai_textgen import OpenAITextGenerator\n",
"from llmx.generators.text.textgen import sanitize_provider\n",
"\n",
"provider = sanitize_provider(\"azureopenai\")\n",
"models = {}\n",
"\n",
"text_gen = OpenAITextGenerator(\n",
" api_key=os.environ[\"AZURE_OPENAI_API_KEY\"],\n",
" api_base=os.environ[\"AZURE_OPENAI_BASE\"],\n",
" provider=provider,\n",
" models=models\n",
")\n",
"lida = Manager(text_gen=text_gen)\n",
"```\n",
"\n",
"\n",
"### Summarization Methods \n",
"The summarizer module works takes an `summary_method` argument which determines if the base summary is enriched by an LLM. By default, the `summary_method` argument is set to `default` for a base summary (statistics etc). Set it to `llm` to enrich/annotate the base summary with an llm.\n",
Expand Down

0 comments on commit 5bfcc87

Please sign in to comment.