mirror of
https://github.com/arc53/DocsGPT
synced 2024-11-02 03:40:17 +00:00
Create test_ingestion.py
This commit is contained in:
parent
bac25112b7
commit
20a0800aa7
19
scripts/test_ingestion.py
Normal file
19
scripts/test_ingestion.py
Normal file
@ -0,0 +1,19 @@
|
||||
import os
|
||||
|
||||
import dotenv
|
||||
import tiktoken
|
||||
from langchain import FAISS
|
||||
from langchain.embeddings import OpenAIEmbeddings
|
||||
|
||||
dotenv.load_dotenv()
|
||||
embeddings_key = os.getenv("API_KEY")
|
||||
docsearch = FAISS.load_local('outputs/inputs', OpenAIEmbeddings(openai_api_key=embeddings_key))
|
||||
|
||||
d1 = docsearch.similarity_search("Whats new in 1.5.3?")
|
||||
print(d1)
|
||||
print("=====================================")
|
||||
print("=====================================")
|
||||
for i in d1:
|
||||
print("docs length (tokens)")
|
||||
doc_len = len(tiktoken.get_encoding("cl100k_base").encode(i.page_content))
|
||||
print(doc_len)
|
Loading…
Reference in New Issue
Block a user