vanna 0.0.10__tar.gz → 0.0.11__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vanna
3
- Version: 0.0.10
3
+ Version: 0.0.11
4
4
  Summary: Generate SQL queries from natural language
5
5
  Author-email: Zain Hoda <zain@vanna.ai>
6
6
  Project-URL: Homepage, https://github.com/vanna-ai/vanna-py
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "vanna"
3
- version = "0.0.10"
3
+ version = "0.0.11"
4
4
  authors = [
5
5
  { name="Zain Hoda", email="zain@vanna.ai" },
6
6
  ]
@@ -204,6 +204,7 @@ def add_user_to_dataset(dataset: str, email: str, is_admin: bool) -> bool:
204
204
  Args:
205
205
  dataset (str): The name of the dataset to add the user to.
206
206
  email (str): The email address of the user to add.
207
+ is_admin (bool): Whether or not the user should be an admin.
207
208
 
208
209
  Returns:
209
210
  bool: True if the user was added successfully, False otherwise.
@@ -258,14 +259,14 @@ def _set_org(org: str) -> None:
258
259
  d = __unauthenticated_rpc_call(method="check_org_exists", params=[Organization(name=org, user=None, connection=None)])
259
260
 
260
261
  if 'result' not in d:
261
- raise Exception("Failed to check if organization exists")
262
+ raise Exception("Failed to check if dataset exists")
262
263
 
263
264
  status = Status(**d['result'])
264
265
 
265
266
  if status.success:
266
267
  raise Exception(f"An organization with the name {org} already exists")
267
268
 
268
- create = input(f"Would you like to create organization '{org}'? (y/n): ")
269
+ create = input(f"Would you like to create dataset '{org}'? (y/n): ")
269
270
 
270
271
  if create.lower() == 'y':
271
272
  db_type = input("What type of database would you like to use? (Snowflake, BigQuery, Postgres, etc.): ")
@@ -274,7 +275,7 @@ def _set_org(org: str) -> None:
274
275
  __org = org
275
276
  else:
276
277
  __org = None
277
- raise Exception("Failed to create organization")
278
+ raise Exception("Failed to create dataset")
278
279
  else:
279
280
  __org = org
280
281
 
@@ -509,6 +510,41 @@ def generate_sql(question: str) -> str:
509
510
 
510
511
  return sql_answer.sql
511
512
 
513
+ def generate_followup_questions(question: str, df: pd.DataFrame) -> List[str]:
514
+ """
515
+ ## Example
516
+ ```python
517
+ vn.generate_followup_questions(question="What is the average salary of employees?", df=df)
518
+ # ['What is the average salary of employees in the Sales department?', 'What is the average salary of employees in the Engineering department?', ...]
519
+ ```
520
+
521
+ Generate follow-up questions using the Vanna.AI API.
522
+
523
+ Args:
524
+ question (str): The question to generate follow-up questions for.
525
+ df (pd.DataFrame): The DataFrame to generate follow-up questions for.
526
+
527
+ Returns:
528
+ List[str] or None: The follow-up questions, or None if an error occurred.
529
+ """
530
+ params = [DataResult(
531
+ question=question,
532
+ sql=None,
533
+ table_markdown=df.head().to_markdown(),
534
+ error=None,
535
+ correction_attempts=0,
536
+ )]
537
+
538
+ d = __rpc_call(method="generate_followup_questions", params=params)
539
+
540
+ if 'result' not in d:
541
+ return None
542
+
543
+ # Load the result into a dataclass
544
+ question_string_list = QuestionStringList(**d['result'])
545
+
546
+ return question_string_list.questions
547
+
512
548
  def generate_questions() -> List[str]:
513
549
  """
514
550
  ## Example
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vanna
3
- Version: 0.0.10
3
+ Version: 0.0.11
4
4
  Summary: Generate SQL queries from natural language
5
5
  Author-email: Zain Hoda <zain@vanna.ai>
6
6
  Project-URL: Homepage, https://github.com/vanna-ai/vanna-py
File without changes
File without changes
File without changes
File without changes