$schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json
type: command

tags:
    Preview: ""

version: 0.0.83
name: llm_rag_validate_deployments
display_name: LLM - Validate Deployments
is_deterministic: false

description: |
  Validates that completion model, embedding model, and Azure Cognitive Search resource deployments is successful and connections works.
  For default AOAI, it attempts to create the deployments if not valid or present.
  This validation is done only if customer is using Azure Open AI models or creating an ACS index.

inputs:
  embeddings_model:
    type: string
    optional: false
    description: The model to use to embed data. E.g. 'hugging_face://model/sentence-transformers/all-mpnet-base-v2' or 'azure_open_ai://deployment/{deployment_name}/model/{model_name}'
  embeddings_connection:
    type: string
    optional: true
    description: The connection id of the Embeddings Model provider to use.
  llm_config:
    type: string
    optional: true
    default: '{"type": "azure_open_ai", "model_name": "gpt-35-turbo", "deployment_name": "gpt-35-turbo", "temperature": 0, "max_tokens": 2000}'
    description: "JSON Configuration for what model to use for question generation. Must contain following keys: 'type' (value must be 'azure_open_ai' or 'azure'), 'model_name' (name of model to use for summary), 'deployment_name' (name of deployment for model), 'temperature' (randomness in response, float from 0 to 1), 'max_tokens' (number of tokens for response)."
  llm_connection:
    type: string
    optional: true
  acs_config:
    type: string
    optional: true
    description: 'JSON string containing the ACS configuration. e.g. {"index_name": "my-index"}'
  index_connection:
    type: string
    optional: true
    description: The connection id of the ACS provider to use.
outputs:
  output_data:
    type: uri_file

environment: azureml:llm-rag-embeddings@latest
code: '../src'

command: >-
  python -m azureml.rag.tasks.validate_deployments
  --embeddings_model '${{inputs.embeddings_model}}'
  $[[--embeddings_connection_id ${{inputs.embeddings_connection}}]]
  $[[--llm_config '${{inputs.llm_config}}']]
  $[[--llm_connection_id ${{inputs.llm_connection}}]]
  $[[--index_config '${{inputs.acs_config}}']]
  $[[--index_connection_id ${{inputs.index_connection}}]]
  --output_data ${{outputs.output_data}}