Skip to content

Commit 2795e09

Browse files
committed
More fine grained control over configs
1 parent 4437d2b commit 2795e09

File tree

4 files changed

+47
-8
lines changed

4 files changed

+47
-8
lines changed

.github/workflows/run_complete_llm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ jobs:
5252
- name: Run pipeline (Staging)
5353
working-directory: ./llm-complete-guide
5454
run: |
55-
python run.py --rag --evaluation --no-cache
55+
python pipelines/llm_basic_rag.py --config=rag_gcp_yaml --no-cache

llm-complete-guide/configs/rag_gcp.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ settings:
1111
- psycopg2-binary
1212
- tiktoken
1313
- ratelimit
14+
- rerankers
1415
environment:
1516
ZENML_PROJECT_SECRET_NAME: llm_complete
1617
ZENML_ENABLE_RICH_TRACEBACK: FALSE
@@ -20,13 +21,13 @@ steps:
2021
url_scraper:
2122
parameters:
2223
docs_url: https://docs.zenml.io
23-
generate_embeddings:
24-
step_operator: "terraform-gcp-6c0fd52233ca"
25-
settings:
26-
step_operator.vertex:
27-
accelerator_type: "NVIDIA_TESLA_P100"
28-
accelerator_count: 1
29-
machine_type: "n1-standard-8"
24+
# generate_embeddings:
25+
# step_operator: "terraform-gcp-6c0fd52233ca"
26+
# settings:
27+
# step_operator.vertex:
28+
# accelerator_type: "NVIDIA_TESLA_P100"
29+
# accelerator_count: 1
30+
# machine_type: "n1-standard-8"
3031

3132
# configuration of the Model Control Plane
3233
model:

llm-complete-guide/configs/rag_local_dev.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ settings:
1313
- psycopg2-binary
1414
- tiktoken
1515
- ratelimit
16+
- rerankers
1617
environment:
1718
ZENML_PROJECT_SECRET_NAME: llm_complete
1819
ZENML_ENABLE_RICH_TRACEBACK: FALSE

llm-complete-guide/pipelines/llm_basic_rag.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
#
17+
import os
18+
from typing import Optional
19+
20+
import click
21+
from litellm import enable_cache
1722

1823
from steps.populate_index import (
1924
generate_embeddings,
@@ -41,3 +46,35 @@ def llm_basic_rag() -> None:
4146
processed_docs = preprocess_documents(documents=docs)
4247
embedded_docs = generate_embeddings(split_documents=processed_docs)
4348
index_generator(documents=embedded_docs)
49+
50+
51+
@click.option(
52+
"--no-cache",
53+
"no_cache",
54+
is_flag=True,
55+
default=False,
56+
help="Disable cache.",
57+
)
58+
@click.option(
59+
"--config",
60+
"config",
61+
default="rag_local_dev.yaml",
62+
help="Specify a configuration file"
63+
)
64+
def main(
65+
no_cache: bool,
66+
config: Optional[str]= "rag_local_dev.yaml"
67+
):
68+
config_path = os.path.join(
69+
os.path.dirname(os.path.realpath(__file__)),
70+
"configs",
71+
config,
72+
)
73+
llm_basic_rag.with_options(
74+
config_path=config_path,
75+
enable_cache=not no_cache
76+
)()
77+
78+
79+
if __name__ == "__main__":
80+
main()

0 commit comments

Comments
 (0)