Skip to content

Commit

Permalink
fix: fix the deprecation warning and typos
Browse files Browse the repository at this point in the history
  • Loading branch information
cindyli committed Jul 10, 2024
1 parent 7eb58e5 commit daf18dd
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/RAG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ the python script.
### Run Scripts
* Run `rag.py` with a parameter providing the path to the directory of a sentence transformer model
- `python rag.py ./all-MiniLM-L6-v2/`
- The last two responses in the exectution result shows the language model's output
- The last two responses in the execution result shows the language model's output
with and without the use of RAG.
2 changes: 1 addition & 1 deletion docs/ReflectChatHistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ The converted sentences are more accurate and appropriate compared to those gene
### Run Scripts
* Run `chat_history_with_summary.py` or `chat_history_with_prompt.py`
- `python chat_history_with_summary.py` or `python chat_history_with_prompt.py`
- The last two responses in the exectution result shows the language model's output
- The last two responses in the execution result shows the language model's output
with and without the contextual information.
3 changes: 0 additions & 3 deletions jobs/RAG/chat_history_with_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate

# from langchain_core.globals import set_debug
# set_debug(True)

# Define the Ollama model to use
model = "llama3"

Expand Down
3 changes: 0 additions & 3 deletions jobs/RAG/chat_history_with_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate

# from langchain_core.globals import set_debug
# set_debug(True)

# Define the Ollama model to use
model = "llama3"

Expand Down
4 changes: 1 addition & 3 deletions jobs/RAG/rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from langchain_community.document_loaders import TextLoader
from langchain_text_splitters import CharacterTextSplitter
from langchain_community.vectorstores import FAISS
from langchain_community.embeddings import HuggingFaceEmbeddings
from langchain_huggingface import HuggingFaceEmbeddings
from langchain_community.chat_models import ChatOllama
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
Expand All @@ -36,11 +36,9 @@ def printUsageThenExit():

loader = TextLoader(user_doc)
documents = loader.load()
# print(f"Loaded documents (first 2 rows):\n{documents[:2]}\n\n")

text_splitter = CharacterTextSplitter(chunk_size=200, chunk_overlap=0)
splitted_docs = text_splitter.split_documents(documents)
# print(f"Splitted documents (first 2 rows):\n{splitted_docs[:2]}\n\n")

# Instantiate the embedding class
embedding_func = HuggingFaceEmbeddings(model_name=sentence_transformer_dir)
Expand Down
1 change: 1 addition & 0 deletions jobs/RAG/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
langchain_community
langchain_core
langchain_text_splitters
langchain-huggingface
sentence_transformers
faiss-cpu

0 comments on commit daf18dd

Please sign in to comment.