> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompt management tutorial

> Use Orq.ai as a prompt manager for your LLM calls. Fetch deployment configurations at runtime while keeping control over your infrastructure.

## Configuration Management

You can decide to use **orq.ai** only as configuration management for your various LLM backend.

<img src="https://mintcdn.com/orqai/H9mjdYaABF092Mk-/images/docs/100f6f45fc6ade6863ee6bbb26f1c4af9982aab19d51d08f232a24165faa71d4-image-20241024-130956.png?fit=max&auto=format&n=H9mjdYaABF092Mk-&q=85&s=7e36316fb552116caeb0482abd130f65" alt="Configuration Management" width="2169" height="1037" data-path="images/docs/100f6f45fc6ade6863ee6bbb26f1c4af9982aab19d51d08f232a24165faa71d4-image-20241024-130956.png" />

This has some advantages over using AI Gateway:

* You manage **the calls to LLM Models end-to-end**, this lets you keep control over the integration and manage its lifecycle, ensuring data stays within your infrastructure before reaching LLM backends.
* You still benefit from the configuration management on **orq.ai** side and can fetch at runtime the latest configuration from your Deployment.
* You still benefit from [Deployment Routing](/docs/deployments/creating#routing), ensuring your users reach the model you desire, using dynamic Context Attributes.

## Using get\_config

Our API and SDK offer a way to invoke a [Deployment](/docs/deployments/overview) but also a way to fetch its Configuration: **get\_config**

<Info>
  To lean more about get\_config, see its [API Reference](/reference/deployments/get-config).
</Info>

By using this method you will benefit from [Deployment Routing](/docs/deployments/creating#routing) as well all the configurations stored within the Deployment. You can then use this object to call any LLM provider directly from your application.

### Example Call

The following is an example call using our SDKs, the call is similar to the `invoke` call. Its difference is that it returns a configuration object and doesn't execute calls to LLM providers.

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  config = client.deployments.get_config(
    "key" = "Deployment-configuration",
    "context" ={ environments: [ "production" ], locale: [ "en" ]},
    "inputs" ={ country: "Netherlands" },
    "metadata"= {custom-field-name":"custom-metadata-value"}
  )

  print(config.to_dict())
  ```

  ```typescript Typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const deploymentConfig = await client.deployments.getConfig({
     key: "Deployment-configuration",
     context: { environments: [ "production"  ], locale: [  "en"  ] },
     inputs: { country: "Netherlands" },
     metadata: { "custom-field-name": "custom-metadata-value" }
  }););
  ```
</CodeGroup>

> `key`: The deployment to invoke.
>
> `inputs`: The key-value pair of variables to replace in your prompts. Default variables are used if not provided.
>
> `context`: This key-value pair that match your data model and fields declared in your Variant Routing Configuration matrix.
>
> `metadata`: This key-value pairs that you want to attach to the log generated by this request.

<Warning>
  When using **get\_config**, you won't benefit from retries and fallbacks as your calls to LLM providers will be made outside of our Platform.
</Warning>

### Configuration Caching

When using **get\_config**, [Deployment](/docs/deployments/overview) configurations are automatically cached to minimize latency.

The cache is invalidated whenever you make changes to a deployment, ensuring your application always receives the most up-to-date configuration.

This caching mechanism provides fast configuration retrieval while maintaining consistency across your infrastructure.

### Metrics & Logging

By using the `id` returned from your **get\_config** call, you can also add logs back to your deployment and benefit from the [Dashboard](/docs/analytics/dashboards).

To do so, use the `add_metrics` call (see [Add metrics](/reference/deployments/add-metrics). **add\_metrics** lets you track various metrics, including but not limited to chain ID, conversation ID, user ID, feedback (scores), custom metadata, and performance-related statistics.

***
