Skip to content

Commit

Permalink
Merge pull request #1 from a-gleeson/linting-jo
Browse files Browse the repository at this point in the history
Linting
  • Loading branch information
James-Osmond authored Apr 16, 2024
2 parents 67c1811 + 4253652 commit 2d48c41
Show file tree
Hide file tree
Showing 11 changed files with 385 additions and 268 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ Pre commit hooks run after commit to fix up formatting and other issues. Install
pre-commit install
```

You can then run:

```sh
pre-commit run --all-files
```

and commit any changes made to files in the repo.

## 6. Add secrets into .env

- Run `cp .env.template .env` and update the secrets.
Expand Down
5 changes: 1 addition & 4 deletions app/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

from config.logging import setup_logging
from config.settings import ENV
from hackathon.streamlit.utils import (
check_password,
)
from hackathon.streamlit.utils import check_password

get_logger = setup_logging()
logger = get_logger(__name__)
Expand Down Expand Up @@ -155,4 +153,3 @@ def image_to_base64(image):
"""
)
# * [Initialise the data](/initialise_the_data) will load in the previous vacancies from s3.

4 changes: 1 addition & 3 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
PROJECT_PATH = os.environ.get("PROJECT_PATH")
OPENSEARCH_URL = os.environ.get("OPENSEARCH_URL")
OPENSEARCH_BATCH_SIZE = int(os.environ.get("OPENSEARCH_BATCH_SIZE", 500))
OPENSEARCH_ENDPOINT_NAME = os.environ.get(
"OPENSEARCH_ENDPOINT_NAME", "vstore"
)
OPENSEARCH_ENDPOINT_NAME = os.environ.get("OPENSEARCH_ENDPOINT_NAME", "vstore")
OPENSEARCH_INDEX_NAME = os.environ.get("OPENSEARCH_INDEX_NAME", "vacancies")
OPENSEARCH_SKILLS_INDEX_NAME = os.environ.get(
"OPENSEARCH_SKILLS_INDEX_NAME", "unique_skills"
Expand Down
5 changes: 1 addition & 4 deletions hackathon/llm/chain_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
from langchain.schema.output_parser import StrOutputParser
from langchain_core.output_parsers.transform import BaseTransformOutputParser

from hackathon.llm.prompts.core import (

PromptTemplate,
)
from hackathon.llm.prompts.core import PromptTemplate


@dataclass
Expand Down
5 changes: 4 additions & 1 deletion hackathon/llm/llm_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ class LLMRunner:
"""

def __init__(
self, llm: LLM, vectorstore: VectorStore, chain_configs: List[ChainConfig]
self,
llm: LLM,
vectorstore: VectorStore,
chain_configs: List[ChainConfig],
) -> None:
"""
Sets up runner with required components of an llm, vectorstore and a list of llm chain configs.
Expand Down
1 change: 0 additions & 1 deletion hackathon/llm/prompts/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@
"""
"""
)

15 changes: 11 additions & 4 deletions hackathon/streamlit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,25 @@ def initialise_llm_runner():

if VECTOR_STORE_CONFIG == "chroma":
vector_store = ChromaStore(
embedding_function=st_embedder, collection_name=OPENSEARCH_INDEX_NAME
embedding_function=st_embedder,
collection_name=OPENSEARCH_INDEX_NAME,
)
else:
if "skills_os_client" not in st.session_state:
st.session_state["skills_os_client"] = OpensearchClient(
OPENSEARCH_SKILLS_INDEX_NAME, OPENSEARCH_ENDPOINT_NAME, AWS_REGION
OPENSEARCH_SKILLS_INDEX_NAME,
OPENSEARCH_ENDPOINT_NAME,
AWS_REGION,
)
if "vacancy_os_client" not in st.session_state:
st.session_state["vacancy_os_client"] = OpensearchClient(
OPENSEARCH_INDEX_NAME, OPENSEARCH_ENDPOINT_NAME, AWS_REGION
)

vector_store = OpenSearchStore(
st_embedder, OPENSEARCH_INDEX_NAME, st.session_state["vacancy_os_client"]
st_embedder,
OPENSEARCH_INDEX_NAME,
st.session_state["vacancy_os_client"],
)

if LLM_MODEL == "local_llm":
Expand Down Expand Up @@ -180,7 +185,9 @@ def initialise_vector_store_loader():
OPENSEARCH_INDEX_NAME, OPENSEARCH_ENDPOINT_NAME, AWS_REGION
)
vector_store = OpensearchClientStore(
st_embedder, OPENSEARCH_INDEX_NAME, st.session_state["vacancy_os_client"]
st_embedder,
OPENSEARCH_INDEX_NAME,
st.session_state["vacancy_os_client"],
)

if LOADER_CONFIG == "file_loader":
Expand Down
7 changes: 6 additions & 1 deletion hackathon/vectorstore/vectorstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ def retrieve_data_with_score(self, query):
return self.vectorstore.similarity_search_with_score(query, k=10)

def retrieve_data(
self, query: str, search_type: str, space_type: str, pre_filter, k: int = 5
self,
query: str,
search_type: str,
space_type: str,
pre_filter,
k: int = 5,
):
"""
Similarity search which returns values with score attachmend with up to k results,
Expand Down
Loading

0 comments on commit 2d48c41

Please sign in to comment.