This is a powerful tool to access parameters not directly exposed by the Orq.ai panel, or to modify preexisting setting depending on a particular scenario.
Unsupported Parameters
Not all parameters offered by model providers are natively supported by Orq.ai when using Invoke.
Our API offers a way to provide parameters that are not supported, using the extra_param field.
Example:
Here we are injecting the presence_penalty parameter on our model generation. This parameter is available with our provider but not natively exposed through the orq API.
curl --request POST \
     --url https://my.orq.ai/v2/deployments/invoke \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <orq-api-key>' \
     --header 'content-type: application/json' \
     --data '
{
  "key": "my-deployment",
  "context": {
    "environment": "production"
  },
  "extra_params": {
    "presence_penalty": 1.0
  }
}
'
Overwriting Existing Parameters
Overwriting existing parameter can impact your model configuration, use this feature with caution.
extra_params field can also be used to overwrite the Model Configuration defined within the Deployment.
At runtime, you can dynamically override previously defined parameters within Orq.ai.
Example: Overwritingtemperature
Here we are using extra_params to override the temperature parameter that can be also defined within your Prompt Configuration
curl --request POST \
     --url https://my.dev.orq.ai/v2/deployments/invoke \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "key": "my-deployment",
  "context": {
    "environment": "production"
  },
  "extra_params": {
    "temperature": 0.4
  }
}
'
Example: Overwritingresponse_format
All parameters can be overwritten including complex ones, in this example, we’re overwriting response_format to dynamically set the response format for the generation to a predefined JSON object.
curl --request POST \
     --url https://my.dev.orq.ai/v2/deployments/invoke \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "key": "my-deployment",
  "context": {
    "environment": "production"
  },
  "extra_params": {
    "response_format": {
       json_schema: <schema>,
       type: "json_schema"
    }
  }
}
'
# Here <schema> is a valid JSON Object containing the definition of fields to return
# Example:
# {
#  "name": "object_name",
#  "strict": true,
#  "schema": {
#    "type": "object",
#    "properties": {
#      "field1": {
#        "type": "integer",
#        "description": "First integer field"
#      },
#      "field2": {
#        "type": "integer",
#        "description": "Second integer field"
#      }
#    },
#    "additionalProperties": false,
#    "required": [
#      "field1",
#      "field2"
#    ]
#  }
# }