Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,9 @@
|
|
1 |
# version for gradio
|
2 |
import gradio as gr
|
3 |
-
from llama_index.llms.llama_cpp import LlamaCPP
|
4 |
from llama_index.vector_stores.mongodb import MongoDBAtlasVectorSearch
|
5 |
import pymongo
|
6 |
from pymongo.mongo_client import MongoClient
|
7 |
-
from pymongo.operations import SearchIndexModel
|
8 |
-
from llama_index.core import VectorStoreIndex, StorageContext
|
9 |
-
|
10 |
from llama_index.core.vector_stores.types import VectorStoreQuery
|
11 |
-
|
12 |
from langchain_nomic.embeddings import NomicEmbeddings
|
13 |
import os
|
14 |
###### load LLM
|
@@ -22,7 +17,6 @@ llm_json_mode = ChatOllama(model=local_llm, temperature=0, format="json")
|
|
22 |
|
23 |
# load embedding model
|
24 |
# sentence transformers
|
25 |
-
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
26 |
embed_model = NomicEmbeddings(model="nomic-embed-text-v1.5", inference_mode="local")
|
27 |
|
28 |
# Load vector database
|
@@ -43,7 +37,7 @@ vector_store = MongoDBAtlasVectorSearch(mongo_client, db_name=DB_NAME, collectio
|
|
43 |
# COMPONENT
|
44 |
### Router
|
45 |
import json
|
46 |
-
from langchain_core.messages import HumanMessage
|
47 |
|
48 |
# Prompt
|
49 |
### Generate
|
|
|
1 |
# version for gradio
|
2 |
import gradio as gr
|
|
|
3 |
from llama_index.vector_stores.mongodb import MongoDBAtlasVectorSearch
|
4 |
import pymongo
|
5 |
from pymongo.mongo_client import MongoClient
|
|
|
|
|
|
|
6 |
from llama_index.core.vector_stores.types import VectorStoreQuery
|
|
|
7 |
from langchain_nomic.embeddings import NomicEmbeddings
|
8 |
import os
|
9 |
###### load LLM
|
|
|
17 |
|
18 |
# load embedding model
|
19 |
# sentence transformers
|
|
|
20 |
embed_model = NomicEmbeddings(model="nomic-embed-text-v1.5", inference_mode="local")
|
21 |
|
22 |
# Load vector database
|
|
|
37 |
# COMPONENT
|
38 |
### Router
|
39 |
import json
|
40 |
+
from langchain_core.messages import HumanMessage
|
41 |
|
42 |
# Prompt
|
43 |
### Generate
|