Skip to content

Commit

Permalink
Fix TypeError: 'type' object is not subscriptable
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonTidef committed Jan 18, 2024
1 parent c1a018a commit 9835e01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/vanna/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def generate_followup_questions(self, question: str, **kwargs) -> str:
numbers_removed = re.sub(r"^\d+\.\s*", "", llm_response, flags=re.MULTILINE)
return numbers_removed.split("\n")

def generate_questions(self, **kwargs) -> list[str]:
def generate_questions(self, **kwargs) -> List[str]:
"""
**Example:**
```python
Expand All @@ -94,7 +94,7 @@ def generate_questions(self, **kwargs) -> list[str]:

# ----------------- Use Any Embeddings API ----------------- #
@abstractmethod
def generate_embedding(self, data: str, **kwargs) -> list[float]:
def generate_embedding(self, data: str, **kwargs) -> List[float]:
pass

# ----------------- Use Any Database to Store and Retrieve Context ----------------- #
Expand Down
3 changes: 2 additions & 1 deletion src/vanna/chromadb/chromadb_vector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
from typing import List
import uuid
from abc import abstractmethod

Expand Down Expand Up @@ -34,7 +35,7 @@ def __init__(self, config=None):
name="sql", embedding_function=default_ef
)

def generate_embedding(self, data: str, **kwargs) -> list[float]:
def generate_embedding(self, data: str, **kwargs) -> List[float]:
embedding = default_ef([data])
if len(embedding) == 1:
return embedding[0]
Expand Down

0 comments on commit 9835e01

Please sign in to comment.