Spaces:
Configuration error
Configuration error
test
Browse files
app.py
CHANGED
|
@@ -14,19 +14,21 @@ class RepoSearch:
|
|
| 14 |
def __init__(self):
|
| 15 |
|
| 16 |
# db_path = os.path.join(root_path, "database", "faiss_index")
|
| 17 |
-
db_path = root_path
|
| 18 |
-
embeddings = OpenAIEmbeddings(api_key="sk-Mo5K9m2hKXjV1DeGeBAIzXLZFxxiOTvSwUoemKmfMXdmE9Bs",
|
| 19 |
-
base_url="https://api.wlai.vip/v1",
|
| 20 |
-
model="text-embedding-3-small")
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
def search(self, query, k=10):
|
| 27 |
'''
|
| 28 |
name + description + html_url + topics
|
| 29 |
'''
|
|
|
|
| 30 |
results = self.vector_db.similarity_search(query + " technology", k=k)
|
| 31 |
|
| 32 |
simple_str = ""
|
|
|
|
| 14 |
def __init__(self):
|
| 15 |
|
| 16 |
# db_path = os.path.join(root_path, "database", "faiss_index")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
# db_path = root_path
|
| 19 |
+
# embeddings = OpenAIEmbeddings(api_key="sk-Mo5K9m2hKXjV1DeGeBAIzXLZFxxiOTvSwUoemKmfMXdmE9Bs",
|
| 20 |
+
# base_url="https://api.wlai.vip/v1",
|
| 21 |
+
# model="text-embedding-3-small")
|
| 22 |
+
|
| 23 |
+
# assert os.path.exists(db_path), f"Database not found: {db_path}"
|
| 24 |
+
# self.vector_db = FAISS.load_local(db_path, embeddings,
|
| 25 |
+
# allow_dangerous_deserialization=True)
|
| 26 |
|
| 27 |
def search(self, query, k=10):
|
| 28 |
'''
|
| 29 |
name + description + html_url + topics
|
| 30 |
'''
|
| 31 |
+
return "sss"
|
| 32 |
results = self.vector_db.similarity_search(query + " technology", k=k)
|
| 33 |
|
| 34 |
simple_str = ""
|