Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
@@ -25,7 +25,6 @@ import uuid
|
|
25 |
import requests
|
26 |
import json
|
27 |
from langchain_core.documents import Document
|
28 |
-
from langchain_community.vectorstores import FAISS
|
29 |
from youtube_transcript_api import YouTubeTranscriptApi
|
30 |
from youtube_transcript_api._errors import TranscriptsDisabled, VideoUnavailable
|
31 |
import re
|
@@ -62,7 +61,8 @@ from langchain.schema import Document
|
|
62 |
|
63 |
from langchain_community.vectorstores import FAISS
|
64 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
65 |
-
from langchain.tools.retriever import create_retriever_tool
|
|
|
66 |
|
67 |
load_dotenv()
|
68 |
|
@@ -343,12 +343,7 @@ for name in enabled_tool_names:
|
|
343 |
# Prepare Documents
|
344 |
# -----------------------------
|
345 |
# Define the URL where the JSON file is hosted
|
346 |
-
|
347 |
-
import gradio as gr
|
348 |
-
from langchain.schema import Document
|
349 |
-
import json
|
350 |
-
from langchain.embeddings import HuggingFaceEmbeddings
|
351 |
-
from langchain.vectorstores import FAISS
|
352 |
import faiss
|
353 |
|
354 |
# 1. Type-Checked State for Gradio
|
@@ -397,14 +392,8 @@ def create_documents(data_source: str, data: List[dict]) -> List[Document]:
|
|
397 |
return docs
|
398 |
|
399 |
# 4. Vector Store Integration
|
400 |
-
|
401 |
-
import json
|
402 |
import faiss
|
403 |
-
from langchain.vectorstores import FAISS
|
404 |
-
from langchain.embeddings import HuggingFaceEmbeddings
|
405 |
-
from langchain.tools import create_retriever_tool
|
406 |
-
from langchain.llms import HuggingFaceEndpoint
|
407 |
-
from your_module import create_documents # Replace with your actual import
|
408 |
|
409 |
# Custom FAISS wrapper (optional, if you still want it)
|
410 |
class MyVector_Store:
|
|
|
25 |
import requests
|
26 |
import json
|
27 |
from langchain_core.documents import Document
|
|
|
28 |
from youtube_transcript_api import YouTubeTranscriptApi
|
29 |
from youtube_transcript_api._errors import TranscriptsDisabled, VideoUnavailable
|
30 |
import re
|
|
|
61 |
|
62 |
from langchain_community.vectorstores import FAISS
|
63 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
64 |
+
#from langchain.tools.retriever import create_retriever_tool
|
65 |
+
from langchain_community.tools import create_retriever_tool
|
66 |
|
67 |
load_dotenv()
|
68 |
|
|
|
343 |
# Prepare Documents
|
344 |
# -----------------------------
|
345 |
# Define the URL where the JSON file is hosted
|
346 |
+
|
|
|
|
|
|
|
|
|
|
|
347 |
import faiss
|
348 |
|
349 |
# 1. Type-Checked State for Gradio
|
|
|
392 |
return docs
|
393 |
|
394 |
# 4. Vector Store Integration
|
395 |
+
|
|
|
396 |
import faiss
|
|
|
|
|
|
|
|
|
|
|
397 |
|
398 |
# Custom FAISS wrapper (optional, if you still want it)
|
399 |
class MyVector_Store:
|