Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enriched result vector not passed to storage when using weaviate #342

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions babyagi.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

client = chromadb.Client(Settings(anonymized_telemetry=False))

# Use Weaviate instead of ChromaDB
WEAVIATE_USE_EMBEDDED = os.getenv("WEAVIATE_USE_EMBEDDED", "False").lower() == "true"

# Engine configuration

# Model: GPT, LLAMA, HUMAN, etc.
Expand Down Expand Up @@ -250,7 +253,6 @@ def query(self, query: str, top_results_num: int) -> List[dict]:
# Initialize results storage
def try_weaviate():
WEAVIATE_URL = os.getenv("WEAVIATE_URL", "")
WEAVIATE_USE_EMBEDDED = os.getenv("WEAVIATE_USE_EMBEDDED", "False").lower() == "true"
if (WEAVIATE_URL or WEAVIATE_USE_EMBEDDED) and can_import("extensions.weaviate_storage"):
WEAVIATE_API_KEY = os.getenv("WEAVIATE_API_KEY", "")
from extensions.weaviate_storage import WeaviateResultsStorage
Expand Down Expand Up @@ -573,11 +575,11 @@ def main():
}
# extract the actual result from the dictionary
# since we don't do enrichment currently
# vector = enriched_result["data"]
vector = enriched_result["data"] if WEAVIATE_USE_EMBEDDED else None

result_id = f"result_{task['task_id']}"

results_storage.add(task, result, result_id)
results_storage.add(task, result, result_id, vector=vector)

# Step 3: Create new tasks and re-prioritize task list
# only the main instance in cooperative mode does that
Expand Down