<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Simplifying Multi-Model LLM Development: A Developer’s Guide to LiteLLM and Databricks in Technical Blog</title>
    <link>https://community.databricks.com/t5/technical-blog/simplifying-multi-model-llm-development-a-developer-s-guide-to/ba-p/80623</link>
    <description>&lt;P&gt;&lt;A href="https://docs.litellm.ai/docs/providers/databricks" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;LLMs on Databricks are now available to call via LiteLLM&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;. &lt;/SPAN&gt;&lt;A href="https://github.com/BerriAI/litellm" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;LiteLLM&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; is a library that provides a python client and an OpenAI-compatible proxy for accessing &lt;/SPAN&gt;&lt;A href="https://docs.litellm.ai/docs/providers" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;100+ LLMs&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; with the same input/output formats, making it easy to manage and switch between models from different providers. This includes both hosted models (OpenAI/Azure/Bedrock, etc.) and self-hosted models (Ollama/VLLM/TGI, etc.). LiteLLM also works &lt;/SPAN&gt;&lt;A href="https://docs.litellm.ai/docs/embedding/supported_embedding" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;across different endpoints&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;—chat, completion, embeddings, image generation, etc.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2&gt;&lt;STRONG&gt;What Databricks models are available?&amp;nbsp;&lt;/STRONG&gt;&lt;/H2&gt;
&lt;P&gt;&lt;SPAN&gt;LiteLLM supports models available via the foundation models API, external models, and other chat and embedding models hosted with model serving. This includes chat, completion, and embedding models.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This post will show how to start using LiteLLM with Databricks. We’ll start with a quick discussion of how LiteLLM and Databricks complement each other. Next, we’ll work through a quickstart example of using &lt;/SPAN&gt;&lt;SPAN&gt;litellm.completion&lt;/SPAN&gt;&lt;SPAN&gt; to call models from the Databricks Foundation Models API. Next, the post gives a demo of the LiteLLM OpenAI Proxy. We’ll use the proxy to call models from different providers and to log usage. The post concludes with some examples and links to other ways of using LiteLLM with Databricks models.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2&gt;&lt;SPAN&gt;Why use LiteLLM with Databricks?&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P&gt;&lt;SPAN&gt;Using LiteLLM with &lt;/SPAN&gt;&lt;A href="https://docs.databricks.com/en/machine-learning/model-serving/index.html" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;Databricks model serving&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; builds on the flexibility offered by both for managing and deploying LLMs. Databricks provides robust MLOps capabilities, scalable inference, production-ready observability features, and support for various open-weights models and proprietary models from providers like Anthropic and OpenAI.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;LiteLLM complements these capabilities with a unified API for numerous LLM providers and local or self-hosted LLM platforms, simplifying the process of swapping and testing different models or using local models for testing. It also offers additional features such as &lt;/SPAN&gt;&lt;A href="https://docs.litellm.ai/docs/proxy/cost_tracking" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;cost tracking&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;A href="https://docs.litellm.ai/docs/proxy/reliability" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;error handling&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;, and &lt;/SPAN&gt;&lt;A href="https://docs.litellm.ai/docs/proxy/logging" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;logging&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;LiteLLM’s support for Databricks models enables developers to:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;A href="https://docs.litellm.ai/docs/#basic-usage" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;Quickly prototype&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; apps across different LLM providers (Databricks/Anthropic/OpenAI/etc.) with a fixed interface&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;A href="https://docs.litellm.ai/docs/routing#advanced---routing-strategies-%EF%B8%8F" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;Maximize TPM/RPM limits&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; across multiple deployments for the same LLM&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;A href="https://docs.litellm.ai/docs/routing#fallbacks" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;Implement fallback &lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;mechanisms between Databricks models and other model providers for enhanced reliability&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Transition between self-hosted models and models hosted on Databricks Model Serving for simplified local development and testing.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;H2&gt;&lt;SPAN&gt;Quickstart: Using the Python Client&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P&gt;&lt;SPAN&gt;The LiteLLM Python Client makes it easy to invoke models from different providers via a consistent interface in Python.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3&gt;&lt;SPAN&gt;Installation and Setup&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;First, install LiteLLM into your Python environment with&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;pip install ‘litellm[proxy]’&lt;/SPAN&gt;&lt;SPAN&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Next, set up your Databricks model serving credentials:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;export DATABRICKS_API_KEY=&amp;lt;your_databricks_PAT&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;export DATABRICKS_API_BASE=https://&amp;lt;your_databricks_workspace&amp;gt;/serving-endpoints&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;With these setup steps completed, we can start invoking Databricks models using LiteLLM. LiteLLM enables us to use models from any supported provider, including Databricks Model Serving, via the same interface using the LiteLLM Python client.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H4&gt;&lt;SPAN&gt;Calling DBRX via Databricks Model Serving&lt;/SPAN&gt;&lt;/H4&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from litellm import completion

response = completion(
    model="databricks/databricks-dbrx-instruct",
    messages=[
        {"content": "You are a helpful assistant.", "role": "system"},
        {
            "content": "Is this sentence correct? 'Their are many countries in Europe'",
            "role": "user",
        },
    ],
)

print(response)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Which returns:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ModelResponse(
    id='chatcmpl_fee3bc28-562e-4c67-bf14-5628d6cd348c',
    choices=[
        Choices(
            finish_reason='stop',
            index=0,
            message=Message(
                content='No, the sentence is not correct. The correct form should be "There are many countries in 
Europe." The word "their" is a possessive pronoun, while "there" is used to indicate a place or to introduce a 
sentence.',
                role='assistant'
            )
        )
    ],
    created=1720191284,
    model='dbrx-instruct-032724',
    object='chat.completion',
    system_fingerprint=None,
    usage=Usage(prompt_tokens=32, completion_tokens=49, total_tokens=81)
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;You can use the same approach to call self-hosted models and models from other providers, simplifying the process of using multiple models in a project without needing to learn each provider’s specific APIs and clients.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Now that you have a basic understanding of why it might be useful to use Databricks model serving with LiteLLM and how to get started with the LiteLLM Python client, let’s look into some of the powerful features enabled via the LiteLLM OpenAI Proxy.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2&gt;&lt;SPAN&gt;Demo: Monitoring Usage with the LiteLLM Proxy&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P&gt;&lt;SPAN&gt;Suppose you are working with a team of developers and want to enable them to access models from multiple providers and keep track of usage. The LiteLLM &lt;/SPAN&gt;&lt;A href="https://litellm.vercel.app/docs/simple_proxy" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;OpenAI Proxy Server&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; allows us to set up an OpenAI-compatible proxy that lets developers call any supported provider using curl requests or the OpenAI Python SDK. The proxy server includes features such as &lt;/SPAN&gt;&lt;A href="https://litellm.vercel.app/docs/proxy/virtual_keys" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;authentication/key management&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;A href="https://litellm.vercel.app/docs/proxy/virtual_keys#advanced---spend-tracking" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;spend tracking&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;A href="https://litellm.vercel.app/docs/proxy/reliability#quick-start---load-balancing" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;load balancing&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;, and &lt;/SPAN&gt;&lt;A href="https://litellm.vercel.app/docs/proxy/reliability#quick-start---load-balancing" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;fallbacks&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="litellm_excal.png" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/9963iDA911C0FDB0027AE/image-size/large?v=v2&amp;amp;px=999" role="button" title="litellm_excal.png" alt="litellm_excal.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In this example, we will use the proxy to give developers access to the Databricks DBRX model and the Anthropic Claude 3.5 Sonnet model, and then log their respective token usages.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3&gt;&lt;SPAN&gt;Configure and Start the Proxy Server&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;We’ll configure the proxy server with the following &lt;/SPAN&gt;&lt;SPAN&gt;config.yaml&lt;/SPAN&gt;&lt;SPAN&gt; file. This configuration will expose the Databricks DBRX model from Databricks Model Serving and Claude 3.5 Sonnet via the Anthropic API.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;model_list:
  - model_name: dbrx
    litellm_params:
      model: databricks/databricks-dbrx-instruct
      api_key: os.environ/DATABRICKS_API_KEY
      api_base: os.environ/DATABRICKS_API_BASE
  - model_name: claude
    litellm_params:
      model: databricks/claude-3-5-sonnet
      api_key: os.environ/ANTHROPIC_API_KEY
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;We can then start the server with:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;litellm --config config.yaml&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;H3&gt;&lt;SPAN&gt;Call Models with the OpenAI Client&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;And call either of these models with OpenAI-compatible methods. For example, we can now use the OpenAI Python client to call DBRX via the LiteLLM proxy as follows:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import openai
client = openai.OpenAI(
    api_key="anything",
    base_url="http://0.0.0.0:4000"
)

response = client.chat.completions.create(model="dbrx", messages = [
    {
        "role": "user",
        "content": "Is this sentence correct? 'Their are many countries in Europe'"
    }
],
max_tokens=25)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;To use Claude instead, all we need to do is change the model name:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;response&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;client.chat.completions.create(model=&lt;/SPAN&gt;&lt;SPAN&gt;"claude"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;SPAN&gt;messages&lt;/SPAN&gt; &lt;SPAN&gt;= ...&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Everything else stays the same, making it very easy to switch between models. You can also use OpenAI-compatible REST API calls via, for example, &lt;/SPAN&gt;&lt;SPAN&gt;curl&lt;/SPAN&gt;&lt;SPAN&gt; or the Python &lt;/SPAN&gt;&lt;SPAN&gt;requests&lt;/SPAN&gt;&lt;SPAN&gt; library.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3&gt;&lt;SPAN&gt;Monitoring Costs and Usage&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN&gt;The LiteLLM OpenAI Proxy Server lets us &lt;/SPAN&gt;&lt;A href="https://docs.litellm.ai/docs/proxy/streaming_logging" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;log token usage&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;. This lets us collect cost and usage details in one place, saving us from needing to check the usage dashboards of multiple different LLM providers. We can do this by &lt;/SPAN&gt;&lt;A href="https://docs.litellm.ai/docs/proxy/streaming_logging#step-1---create-your-custom-litellm-callback-class" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;implementing a callback&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; and adding it to our config. To log usage, create a new file called &lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="andale mono,times"&gt;custom_callbacks.py&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt; and subclass the &lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="andale mono,times"&gt;litellm.integrations.custom_logger.CustomLogger&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt; class:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from litellm.integrations.custom_logger import CustomLogger
import litellm
import logging

class MyCustomHandler(CustomLogger):
    async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):
        try:
            # init logging config
            logging.basicConfig(
                    filename='cost.log',
                    level=logging.INFO,
                    format='%(asctime)s - %(message)s',
                    datefmt='%Y-%m-%d %H:%M:%S'
            )
            response_cost = kwargs.get("response_cost")
            input_tokens = response_obj.usage.prompt_tokens
            output_tokens = response_obj.usage.completion_tokens
            print("input_tokens", input_tokens, "output_tokens", output_tokens)
            logging.info(f"Model: {response_obj.model} Input Tokens: {input_tokens} Output Tokens: {output_tokens} Response Cost: {response_cost}")
        except Exception as e:
            print(f"Failed to log usage: {e}")

proxy_handler_instance = MyCustomHandler()&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;We also need to update the &lt;/SPAN&gt;&lt;SPAN&gt;config.yaml&lt;/SPAN&gt;&lt;SPAN&gt; file to add the cost per input/output token for DBRX. You can use &lt;/SPAN&gt;&lt;A href="https://www.databricks.com/product/pricing/foundation-model-serving" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;this calculator&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; to determine costs depending on your cloud provider and region. We update the DBRX config entry as follows:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;  - model_name: dbrx
    litellm_params:
      model: databricks/databricks-dbrx-instruct
      api_key: os.environ/DATABRICKS_API_KEY
      api_base: os.environ/DATABRICKS_API_BASE
      input_cost_per_token: 0.00000075
      output_cost_per_token: 0.00000225&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;When we call either model via the OpenAI proxy, the token usage and cost information will be recorded in the usage.log file. If needed, we can aggregate and analyze the log data to get a unified view of usage and costs across providers.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;2024-07-16 12:17:55 - Model: dbrx-instruct-032724 Input Tokens: 237 Output Tokens: 47 Response Cost: 0.0002835
2024-07-16 12:18:06 - Model: claude-3-5-sonnet-20240620 Input Tokens: 21 Output Tokens: 145 Response Cost: 0.002238
2024-07-16 12:18:28 - Model: claude-3-5-sonnet-20240620 Input Tokens: 23 Output Tokens: 284 Response Cost: 0.0043289
2024-07-16 12:18:32 - Model: dbrx-instruct-032724 Input Tokens: 238 Output Tokens: 81 Response Cost: 0.00036075
2024-07-16 12:18:55 - Model: dbrx-instruct-032724 Input Tokens: 230 Output Tokens: 37 Response Cost: 0.00025575
2024-07-16 12:22:39 - Model: dbrx-instruct-032724 Input Tokens: 230 Output Tokens: 45 Response Cost: 0.00027375
2024-07-16 12:22:54 - Model: claude-3-5-sonnet-20240620 Input Tokens: 15 Output Tokens: 123 Response Cost: 0.00189
2024-07-16 12:23:28 - Model: claude-3-5-sonnet-20240620 Input Tokens: 18 Output Tokens: 195 Response Cost: 0.002979
2024-07-16 12:23:40 - Model: dbrx-instruct-032724 Input Tokens: 234 Output Tokens: 48 Response Cost: 0.0002835&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;For more advanced user- and team-level monitoring, access management, and spend tracking, you can &lt;/SPAN&gt;&lt;A href="https://docs.litellm.ai/docs/proxy/virtual_keys" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;set up a Postgres database and create API keys&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;. There is also a &lt;/SPAN&gt;&lt;A href="https://docs.litellm.ai/docs/proxy/self_serve" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;UI&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; for adding users, creating keys, monitoring usage, and more.&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2&gt;&lt;SPAN&gt;Other model types&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P&gt;&lt;SPAN&gt;The examples above focused on completions, but it’s worth noting that LiteLLM supports other types of models as well. For example, we can call the &lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="andale mono,times"&gt;gte-large-en&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt; embedding model available via the Databricks foundation models API via &lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="andale mono,times"&gt;litellm.embeddings&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from litellm import embedding

response = embedding(
      model="databricks/databricks-gte-large-en",
      input=["General text embeddings (GTE) can map any text to a low-dimensional dense vector which can be used for tasks like retrieval, classification, clustering, or semantic search. And it also can be used in vector databases for LLMs."],
      instruction="Represent this sentence for searching relevant passages:",
  )

print(response)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Which returns:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;EmbeddingResponse(
    model='gte-large-en-v1.5',
    data=[
        {
            'index': 0,
            'object': 'embedding',
            'embedding': [
                1.0078125,
                -0.25537109375,
                -0.755859375,
                -0.0692138671875,
                [...]
                1.36328125,
                -0.2440185546875,
                -0.2159423828125
            ]
        }
    ],
    object='list',
    usage=Usage(prompt_tokens=62, total_tokens=62)
)&lt;/LI-CODE&gt;
&lt;H2&gt;&lt;SPAN&gt;Next Steps&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P&gt;&lt;SPAN&gt;This was a quick introduction to using Databricks model serving with LiteLLM. After reading this guide, you should be able to:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Call Databricks Model Serving models, and models from other providers, with LiteLLM&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Set up the LiteLLM OpenAI Proxy Server and call models from different sources with the OpenAI Python Client&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Use Completions, Chat, and Embedding models with LiteLLM&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;There is much more you can do with the combination of Databricks model serving and LiteLLM. Here are some ideas:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Serve &lt;/SPAN&gt;&lt;A href="https://docs.databricks.com/en/machine-learning/model-serving/model-serving-intro.html" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;custom chat models&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; with Databricks model serving and add them to your LiteLLM OpenAI Proxy Server&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Add models from other providers: maybe in addition to Databricks and Anthropic models you also want to try out models from some &lt;/SPAN&gt;&lt;A href="https://litellm.vercel.app/docs/providers" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;other providers&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; or even locally-hosted models via Ollama. You can do so by adding them to your proxy config file or calling them directly from the LiteLLM Python client.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;Configure &lt;/SPAN&gt;&lt;A href="https://litellm.vercel.app/docs/proxy/reliability" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;load balancing, fallbacks, retries, and timeouts&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; with the LiteLLM OpenAI proxy server. This is particularly useful if you expect a high volume of requests and want to ensure reliable performance.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;Write a &lt;A style="font-family: inherit; background-color: #ffffff;" href="https://litellm.vercel.app/docs/proxy/logging#custom-callback-class-async" target="_blank" rel="noopener"&gt;custom callback&lt;/A&gt;&lt;SPAN&gt; to log model calls/responses to MLflow.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
    <pubDate>Mon, 05 Aug 2024 16:56:26 GMT</pubDate>
    <dc:creator>Daniel-Liden</dc:creator>
    <dc:date>2024-08-05T16:56:26Z</dc:date>
    <item>
      <title>Simplifying Multi-Model LLM Development: A Developer’s Guide to LiteLLM and Databricks</title>
      <link>https://community.databricks.com/t5/technical-blog/simplifying-multi-model-llm-development-a-developer-s-guide-to/ba-p/80623</link>
      <description>&lt;DIV class="font-claude-message  pr-4  md:pr-9  relative  leading-[1.65rem]  [&amp;amp;_pre&amp;gt;div]:bg-bg-300  [&amp;amp;_pre]:-mr-4  md:[&amp;amp;_pre]:-mr-9"&gt;
&lt;DIV&gt;
&lt;DIV class="grid-col-1 grid gap-2.5 [&amp;amp;_&amp;gt;_*]:min-w-0"&gt;
&lt;P class="whitespace-pre-wrap break-words"&gt;This article introduces the integration of LiteLLM with Databricks, allowing users to access and manage various large language models (LLMs) through a unified interface. It covers how to use LiteLLM's Python client and OpenAI-compatible proxy to call Databricks models, as well as models from other providers. The piece also demonstrates setting up usage monitoring and cost tracking across different LLMs. Examples are provided for using completion, chat, and embedding models via LiteLLM with Databricks model serving.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 05 Aug 2024 16:56:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/technical-blog/simplifying-multi-model-llm-development-a-developer-s-guide-to/ba-p/80623</guid>
      <dc:creator>Daniel-Liden</dc:creator>
      <dc:date>2024-08-05T16:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Simplifying Multi-Model LLM Development: A Developer’s Guide to LiteLLM and Databricks</title>
      <link>https://community.databricks.com/t5/technical-blog/simplifying-multi-model-llm-development-a-developer-s-guide-to/bc-p/101476#M406</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/109683"&gt;@Daniel-Liden&lt;/a&gt;&amp;nbsp;Thanks for this great post - I appreciate the concise overview. It's been a few months now - is this still a recommended way to proxy LLM calls? And if so, where do you recommend serving the LiteLLM proxy?&lt;/P&gt;&lt;P&gt;If it helps, my use case is considering LangChain and I'm particularly trying to understand whether the proxy would be hosted on the same cluster running the LangChain code (potentially a hosted instance in Model Serving) or a standalone service on a separate cluster.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 14:07:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/technical-blog/simplifying-multi-model-llm-development-a-developer-s-guide-to/bc-p/101476#M406</guid>
      <dc:creator>pemidexx</dc:creator>
      <dc:date>2024-12-09T14:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Simplifying Multi-Model LLM Development: A Developer’s Guide to LiteLLM and Databricks</title>
      <link>https://community.databricks.com/t5/technical-blog/simplifying-multi-model-llm-development-a-developer-s-guide-to/bc-p/101478#M407</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/120181"&gt;@pemidexx&lt;/a&gt;&amp;nbsp;Thanks!&lt;/P&gt;
&lt;P&gt;I would check out &lt;A href="https://docs.databricks.com/en/generative-ai/external-models/index.html" target="_self"&gt;External Models&lt;/A&gt; and&amp;nbsp;&lt;A href="https://docs.databricks.com/en/ai-gateway/index.html" target="_self"&gt;Mosaic AI Gateway&lt;/A&gt; as built-in options.&lt;BR /&gt;&lt;BR /&gt;External models provides:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Built-in support for major LLM providers (OpenAI, Anthropic, Cohere, etc.)&lt;/LI&gt;
&lt;LI&gt;Centralized credential management&lt;/LI&gt;
&lt;LI&gt;Unified endpoint interface&lt;/LI&gt;
&lt;LI&gt;Native integration with the rest of the Databricks platform&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;So you wouldn't need to run and maintain a separate proxy service.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 14:36:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/technical-blog/simplifying-multi-model-llm-development-a-developer-s-guide-to/bc-p/101478#M407</guid>
      <dc:creator>Daniel-Liden</dc:creator>
      <dc:date>2024-12-09T14:36:31Z</dc:date>
    </item>
  </channel>
</rss>

