Skip to content

Commit

Permalink
chore: formatted with black
Browse files Browse the repository at this point in the history
  • Loading branch information
broomva committed Mar 12, 2024
1 parent dea04e9 commit 3845997
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
8 changes: 4 additions & 4 deletions example_flows/prefect_flows/gcs_filesystem.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from prefect.filesystems import GCS
from dotenv import load_dotenv
import os

load_dotenv()

block = GCS(
bucket_path="vortex-flows/broomva-flows",
bucket_path="vortex-flows/broomva-flows",
service_account_info=os.environ.get("GCS_SERVICE_ACCOUNT"),
project="broomva-vortex-ai"
project="broomva-vortex-ai",
)
block.save("gcs-vortex-flows", overwrite=True)

#%%
# %%
# # prefect deployment build web_rag.py:web_rag_flow --name web_rag_deployment --tag gcs-vortex-flows -sb gcs/gcs-vortex-flows

7 changes: 4 additions & 3 deletions example_flows/prefect_flows/minio_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
settings={
"key": os.environ.get("MINIO_USER", "minio"),
"secret": os.environ.get("MINIO_PASSWORD", "minio123"),
"client_kwargs": {"endpoint_url": os.environ.get("MINIO_HOST","http://localhost:9001")},
"client_kwargs": {
"endpoint_url": os.environ.get("MINIO_HOST", "http://localhost:9001")
},
},
)
minio_block.save("minio")



# prefect deployment build web_rag.py:web_rag_flow --name web_rag_deployment --tag minio -sb remote-file-system/minio
# prefect deployment build web_rag.py:web_rag_flow --name web_rag_deployment --tag minio -sb remote-file-system/minio
8 changes: 6 additions & 2 deletions example_flows/prefect_flows/web_rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

openai_resource = OpenAIResource()


@task
def get_article(input_url: str) -> str:
if not input_url:
Expand All @@ -20,6 +21,7 @@ def get_article(input_url: str) -> str:
raise e
return response


@task
def summarize_article(article_text: str) -> str:
if not article_text:
Expand All @@ -28,15 +30,17 @@ def summarize_article(article_text: str) -> str:
response = openai_resource.get(user_query)
return response


@flow(log_prints=True)
def web_rag_flow(input_url: str = "https://github.com/Broomva/vortex"):
article_text = get_article(input_url)
article_summary = summarize_article(article_text)
print(article_summary)


if __name__ == "__main__":
web_rag_flow.deploy(
name="web-rag-flow",
name="web-rag-flow",
work_pool_name="broomva-worker",
parameters={"input_url": "https://github.com/Broomva/vortex"},
)
)

0 comments on commit 3845997

Please sign in to comment.