Execute a Pipeline
Installation
# you can use a Conda environment
pip install --extra-index-url https://oauth2accesstoken:$(gcloud auth print-access-token)@glsdk.gdplabs.id/gen-ai-internal/simple/ gllm-core gllm-pipeline# you can use a Conda environment
pip install --extra-index-url https://oauth2accesstoken:$(gcloud auth print-access-token)@glsdk.gdplabs.id/gen-ai-internal/simple/ gllm-core gllm-pipelineFOR /F "tokens=*" %T IN ('gcloud auth print-access-token') DO pip install --extra-index-url "https://oauth2accesstoken:%T@glsdk.gdplabs.id/gen-ai-internal/simple/" gllm-core gllm-pipeline1) Basic Execution with .invoke()
.invoke()When you have a pre-built pipeline, here is how you can execute it:
# Initialize the pipeline
pipeline = step_1 | step_2 | step_3 # or replace it with your prebuilt pipeline
# Prepare initial state
initial_state = {
"user_query": "What is machine learning?",
"history": "",
"context": ""
}
# Execute the pipeline
final_state = await pipeline.invoke(initial_state)
# Access the results
response = final_state["response"]
references = final_state["references"]2) Execution with Configuration
You can also run the pipeline with configuration. Configuration can include debugging, caching, timeouts, retries, and other runtime parameters (top_k for retriever, etc). The configuration is passed to the invoke() method and affects how the pipeline executes.
Last updated