Spaces:
Sleeping
Sleeping
Update app.py
Browse files
agent.py
CHANGED
|
@@ -138,6 +138,19 @@ sentence_transformer.max_seq_length = 512 # Set max sequence length
|
|
| 138 |
# Initialize embeddings with the model name (dim=768)
|
| 139 |
embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-mpnet-base-v2")
|
| 140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
# Initialize Supabase client
|
| 142 |
supabase: Client = create_client(
|
| 143 |
os.environ.get("SUPABASE_URL"),
|
|
|
|
| 138 |
# Initialize embeddings with the model name (dim=768)
|
| 139 |
embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-mpnet-base-v2")
|
| 140 |
|
| 141 |
+
|
| 142 |
+
try:
|
| 143 |
+
results = retriever.get_relevant_documents("What is vector search?")
|
| 144 |
+
if not results:
|
| 145 |
+
raise ValueError("No documents found in the search results.")
|
| 146 |
+
# Access the first result safely if it exists
|
| 147 |
+
first_result = results[0]
|
| 148 |
+
print("First result:", first_result)
|
| 149 |
+
except Exception as e:
|
| 150 |
+
print(f"Error: {e}")
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
|
| 154 |
# Initialize Supabase client
|
| 155 |
supabase: Client = create_client(
|
| 156 |
os.environ.get("SUPABASE_URL"),
|