Compare commits
2 Commits
243afd2f01
...
87727b3d1e
Author | SHA1 | Date |
---|---|---|
Falko Victor Habel | 87727b3d1e | |
Falko Victor Habel | a36eeb368e |
|
@ -81,7 +81,7 @@ You can provide the following files / links as context to Ollama:
|
||||||
- .html
|
- .html
|
||||||
- .md
|
- .md
|
||||||
- .pdf
|
- .pdf
|
||||||
- links to websites
|
- links (Note that only SSL-secured websites are supported)
|
||||||
|
|
||||||
## How the Rag is working in the GUI:
|
## How the Rag is working in the GUI:
|
||||||
|
|
||||||
|
|
|
@ -6,4 +6,5 @@ langchain_community
|
||||||
langchain
|
langchain
|
||||||
pathlib
|
pathlib
|
||||||
unstructured
|
unstructured
|
||||||
markdown
|
markdown
|
||||||
|
requests
|
|
@ -6,6 +6,7 @@ from langchain_community.embeddings import OllamaEmbeddings
|
||||||
from langchain_community.vectorstores import Chroma
|
from langchain_community.vectorstores import Chroma
|
||||||
from langchain_community.chat_models import ChatOllama
|
from langchain_community.chat_models import ChatOllama
|
||||||
from langchain.chains import RetrievalQA
|
from langchain.chains import RetrievalQA
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,9 +41,12 @@ class Rag:
|
||||||
def get_file(self, file_path):
|
def get_file(self, file_path):
|
||||||
# Check if the file path starts with 'https://'
|
# Check if the file path starts with 'https://'
|
||||||
if file_path.startswith('https://'):
|
if file_path.startswith('https://'):
|
||||||
loader = WebBaseLoader(file_path)
|
try:
|
||||||
data = loader.load()
|
loader = WebBaseLoader(file_path)
|
||||||
if data is None:
|
data = loader.load()
|
||||||
|
if data is None:
|
||||||
|
return False
|
||||||
|
except requests.exceptions.SSLError:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
file_type = file_path.split(".")[-1]
|
file_type = file_path.split(".")[-1]
|
||||||
|
@ -61,8 +65,7 @@ class Rag:
|
||||||
loader = PyPDFLoader(file_path=file_path)
|
loader = PyPDFLoader(file_path=file_path)
|
||||||
data = loader.load_and_split()
|
data = loader.load_and_split()
|
||||||
case _:
|
case _:
|
||||||
loader = WebBaseLoader(file_path)
|
return False
|
||||||
data = loader.load()
|
|
||||||
except OSError:
|
except OSError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue