added global variables to the ollama models and watsonx
This commit is contained in:
parent
580c6f8e32
commit
57f3344641
3 changed files with 29 additions and 4 deletions
|
|
@ -67,7 +67,7 @@
|
|||
"input_types": ["Message"],
|
||||
"list": false,
|
||||
"list_add_label": "Add More",
|
||||
"load_from_db": false,
|
||||
"load_from_db": true,
|
||||
"name": "base_url",
|
||||
"placeholder": "",
|
||||
"required": true,
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": ""
|
||||
"value": "OLLAMA_BASE_URL"
|
||||
},
|
||||
"code": {
|
||||
"advanced": true,
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@
|
|||
"input_types": ["Message"],
|
||||
"list": false,
|
||||
"list_add_label": "Add More",
|
||||
"load_from_db": false,
|
||||
"load_from_db": true,
|
||||
"name": "base_url",
|
||||
"placeholder": "",
|
||||
"real_time_refresh": true,
|
||||
|
|
@ -118,7 +118,7 @@
|
|||
"trace_as_input": true,
|
||||
"trace_as_metadata": true,
|
||||
"type": "str",
|
||||
"value": ""
|
||||
"value": "OLLAMA_BASE_URL"
|
||||
},
|
||||
"code": {
|
||||
"advanced": true,
|
||||
|
|
|
|||
|
|
@ -433,6 +433,31 @@ async def onboarding(request, flows_service):
|
|||
)
|
||||
# Continue even if flow assignment fails - configuration was still saved
|
||||
|
||||
# Set Langflow global variables based on provider
|
||||
if "model_provider" in body:
|
||||
provider = body["model_provider"].strip().lower()
|
||||
|
||||
try:
|
||||
# Set API key for IBM/Watson providers
|
||||
if (provider == "watsonx" or provider == "ibm") and "api_key" in body:
|
||||
api_key = body["api_key"]
|
||||
await clients._create_langflow_global_variable("WATSONX_API_KEY", api_key)
|
||||
logger.info("Set WATSONX_API_KEY global variable in Langflow")
|
||||
|
||||
# Set base URL for Ollama provider
|
||||
if provider == "ollama" and "endpoint" in body:
|
||||
endpoint = body["endpoint"]
|
||||
await clients._create_langflow_global_variable("OLLAMA_BASE_URL", endpoint)
|
||||
logger.info("Set OLLAMA_BASE_URL global variable in Langflow")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
"Failed to set Langflow global variables",
|
||||
provider=provider,
|
||||
error=str(e),
|
||||
)
|
||||
# Continue even if setting global variables fails
|
||||
|
||||
# Handle sample data ingestion if requested
|
||||
if should_ingest_sample_data:
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue