Skip to content

Conversation

Jan-Kazlouski-elastic
Copy link
Contributor

@Jan-Kazlouski-elastic Jan-Kazlouski-elastic commented Sep 30, 2025

  • Refactor Mistral, Ai21, Llama, and Hugging Face request entities to accept model IDs.
  • Update GoogleVertexAiActionCreator to handle multiple providers including META, HUGGING_FACE, MISTRAL, and AI21.
  • Enhance serialization tests for model ID handling in chat completion requests.
  • Introduce new response handlers for each Google Model Garden provider.
  • Add Unit Tests
META (Serverless):

Tested with: meta/llama-3.3-70b-instruct-maas

Create Completion Endpoint
URL: /_inference/completion/google-model-garden-meta-completion-1?timeout=5m
Method: PUT
Status Code: 200 OK
RQ:
{
    "service": "googlevertexai",
    "service_settings": {
        "provider": "meta",
        "model_id": "meta/llama-3.3-70b-instruct-maas",
        "service_account_json": "service_account_json",
        "url": "url"
    }
}
RS:
{
    "inference_id": "google-model-garden-meta-completion-1",
    "task_type": "completion",
    "service": "googlevertexai",
    "service_settings": {
        "model_id": "meta/llama-3.3-70b-instruct-maas",
        "url": "url",
        "provider": "META",
        "rate_limit": {
            "requests_per_minute": 1000
        }
    }
}
Perform Non-Streaming Completion
URL: /_inference/completion/google-model-garden-meta-completion-1?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "input": "The sky above the port was the color of television tuned to a dead channel."
}
RS:
{
    "completion": [
        {
            "result": "The iconic opening line of William Gibson's novel \"Neuromancer\" (1984). This sentence has become a classic example of Gibson's unique writing style, which blends elements of science fiction, noir, and poetry.\n\nThe comparison of the sky to a dead television channel is a powerful and evocative metaphor that sets the tone for the rest of the novel. It suggests a world that is bleak, empty, and devoid of meaning, where the usual signals and connections have been disrupted. The image also implies a sense of disconnection and isolation, which is a recurring theme throughout the book.\n\nGibson's use of this metaphor has been widely influential, and it's often cited as an example of his ability to create vivid and immersive descriptions of a futuristic world. The sentence has also been subject to various interpretations and analyses, with some seeing it as a commentary on the effects of technology on society, while others view it as a reflection of the protagonist's own disconnection and alienation.\n\nWhat do you think of this opening line? Do you have a favorite interpretation or analysis of it?"
        }
    ]
}
Perform Streaming Completion
URL: /_inference/completion/google-model-garden-meta-completion-1/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "input": "The sky above the port was the color of television tuned to a dead channel."
}
RS:
event: message
data: {"completion":[{"delta":"The"}]}

event: message
data: {"completion":[{"delta":" iconic opening sentence of William Gibson's novel \"Neuromancer\" (1984). This sentence has become a classic example of cyberpunk literature and a staple of science fiction. The vivid and haunting"}]}

event: message
data: {"completion":[{"delta":" description of the sky as a \"dead channel\" sets the tone for a dystopian world where technology and humanity are intertwined in a bleak and gritty way.\n\nThe sentence's use of a familiar, mundane reference point"}]}

event: message
data: {"completion":[{"delta":" (a TV tuned to a dead channel) to describe the sky creates a sense of unease and disorientation, drawing the reader into a world that is both recognizable and strange. It's a masterful example of Gibson's ability to craft a unique and immersive narrative voice, and it's a big part of what makes \"Neuromancer\" such a influential and beloved work of science fiction.\n\nDo you have a favorite aspect of \"Neuromancer\" or"}]}

event: message
data: {"completion":[{"delta":" the cyberpunk genre in general?"}]}

event: message
data: [DONE]
Create Chat Completion Endpoint
URL: /_inference/chat_completion/google-model-garden-meta-chat-completion-1?timeout=5m
Method: PUT
Status Code: 200 OK
RQ:
{
    "service": "googlevertexai",
    "service_settings": {
        "provider": "meta",
        "model_id": "meta/llama-3.3-70b-instruct-maas",
        "service_account_json": "service_account_json",
        "streaming_url": "streaming_url"
    }
}
RS:
{
    "inference_id": "google-model-garden-meta-chat-completion-1",
    "task_type": "chat_completion",
    "service": "googlevertexai",
    "service_settings": {
        "model_id": "meta/llama-3.3-70b-instruct-maas",
        "streaming_url": "streaming_url",
        "provider": "META",
        "rate_limit": {
            "requests_per_minute": 1000
        }
    }
}
Perform Basic Chat Completion
URL: /_inference/chat_completion/google-model-garden-meta-chat-completion-1/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "messages": [
        {
            "role": "user",
            "content": "What is deep learning?"
        }
    ],
    "max_completion_tokens": 100
}
RS:
event: message
data: {"id":"daPeaIvdK6KU698PoIeRsAk","choices":[{"delta":{"content":"**","role":"assistant"},"index":0}],"model":"meta/llama-3.3-70b-instruct-maas","object":"chat.completion.chunk"}

event: message
data: {"id":"daPeaIvdK6KU698PoIeRsAk","choices":[{"delta":{"content":"Deep Learning Overview**\n==========================\n\nDeep learning is a subset of machine learning that involves the use of artificial neural networks to analyze and interpret data. It is a type of machine learning that is inspired by the structure and function of the human brain, with layers of interconnected nodes (","role":"assistant"},"index":0}],"model":"meta/llama-3.3-70b-instruct-maas","object":"chat.completion.chunk"}

event: message
data: {"id":"daPeaIvdK6KU698PoIeRsAk","choices":[{"delta":{"content":"neurons) that process and transform inputs into meaningful representations.\n\n**Key Characteristics**\n------------------------\n\n*   **Artificial Neural Networks**: Deep learning models are based on artificial neural networks, which are composed of multiple layers of interconnected","role":"assistant"},"finish_reason":"length","index":0}],"model":"meta/llama-3.3-70b-instruct-maas","object":"chat.completion.chunk","usage":{"completion_tokens":100,"prompt_tokens":40,"total_tokens":140}}

event: message
data: [DONE]
Perform Complex Chat Completion
URL: /_inference/chat_completion/google-model-garden-meta-chat-completion-1/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "model": "meta/llama-3.3-70b-instruct-maas",
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "What's the price of a scarf?"
                }
            ]
        }
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "get_current_price",
                "description": "Get the current price of a item",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "item": {
                            "id": "123"
                        }
                    }
                }
            }
        }
    ]
}
RS:
event: message
data: {"id":"d6PeaJCgMtKpnvgPy9zZgQw","choices":[{"delta":{"role":"assistant","tool_calls":[{"index":0,"id":"get_current_price","function":{"arguments":"{\"item\":\"scarf\"}","name":"get_current_price"},"type":"function"}]},"finish_reason":"tool_calls","index":0}],"model":"meta/llama-3.3-70b-instruct-maas","object":"chat.completion.chunk","usage":{"completion_tokens":25,"prompt_tokens":176,"total_tokens":201}}

event: message
data: [DONE]
META (Dedicated Enpoint):

Tested with: meta/llama-3.3-70b-instruct-maas

Create Completion Endpoint
URL: /_inference/completion/google-model-garden-meta-completion-2?timeout=5m
Method: PUT
Status Code: 200 OK
RQ:
{
    "service": "googlevertexai",
    "service_settings": {
        "provider": "meta",
        "service_account_json": "service_account_json",
        "url": "url"
    }
}
RS:
{
    "inference_id": "google-model-garden-meta-completion-2",
    "task_type": "completion",
    "service": "googlevertexai",
    "service_settings": {
        "url": "url",
        "provider": "META",
        "rate_limit": {
            "requests_per_minute": 1000
        }
    }
}
Perform Non-Streaming Completion
URL: /_inference/completion/google-model-garden-meta-completion-2?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "input": "The sky above the port was the color of television tuned to a dead channel."
}
RS:
{
    "completion": [
        {
            "result": "\nA 10-minute drive from the San Francisco International Airport, Millbrae is a small burg of 20,000. Though relatively quiet, it was chosen by the state as the site of the first Bay Area Rapid Transit (BART) station. The station was completed in 1973, and the town has been growing ever since.\nMillbrae is home to nine parks and the bayfront Millbrae Pier. The pier is a favorite spot for fishing, and the San Francisco Bay Water Trail is headquartered in Millbrae. The trail provides information on safe access and enjoyment of the bay, as well as on local water-related activities.\nNearby, the Bayfront Park features a playground, picnic areas and the Millbrae Historical Museum. The museum is housed in the former train station, which was built in 1902 and served the San Francisco, Oakland & Alameda Railroad and the Southern Pacific Railroad. Today, the station houses a railroad museum, and visitors can still see its original stained glass windows and light fixtures.\nThe area also is home to the Millbrae Community Center, a 10,500-square-foot facility that provides a variety of programs and services for residents. The center’s facilities include a swimming pool and a gymnasium. It also has a community room that is available for rent.\nThe center is also home to the Millbrae Art and Historical Society, which is dedicated to preserving and promoting Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history.\nMillbrae has a number of restaurants, including Italian, American, Mexican and Japanese. The area also has a number of shops, including a grocery store, a hardware store and a florist. The Millbrae Farmers’ Market is held every Saturday from 9 a.m. to 1 p.m. at the Millbrae Community Center.\nThe Millbrae Historical Society offers tours of the town’s historic sites, including the Millbrae Train Station, the Millbrae Historical Museum and the Millbrae Art and Historical Society. The tours are free, and they are a great way to learn about the town’s past.\nThe Millbrae Farmers’ Market is held every Saturday from 9 a.m. to 1 p.m. at the Millbrae Community Center. The market features fresh produce, flowers, cheese, baked goods and handmade crafts.\nMillbrae offers a variety of activities for residents and visitors. The town has a number of parks, and the bayfront Millbrae Pier is a popular spot for fishing and other water-related activities. The Millbrae Historical Museum is home to the town’s history, and the Millbrae Art and Historical Society provides educational programs and events. The Millbrae Farmers’ Market is held every Saturday, and the town has a number of restaurants and shops.\nThe Millbrae Art and Historical Society is dedicated to preserving and promoting Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history.\nMillbrae is a small town with a lot to offer residents and visitors. The town has a variety of activities, including a number of parks, a bayfront pier and a farmers’ market. The town is also home to the Millbrae Art and Historical Society, which is dedicated to preserving and promoting Millbrae’s history.\nThe Millbrae Art and Historical Society is a nonprofit organization that is dedicated to preserving and promoting Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history.\nThe Millbrae Art and Historical Society was founded in 1976 by a group of local residents who were interested in preserving and promoting Millbrae’s history. The society is housed in the former train station, which was built in 1902 and served the San Francisco, Oakland & Alameda Railroad and the Southern Pacific Railroad. Today, the station houses a railroad museum, and visitors can still see its original stained glass windows and light fixtures.\nThe Millbrae Art and Historical Society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history. The society’s activities include lectures, tours, and exhibits. The society also publishes a newsletter and a book about Millbrae’s history.\nThe Millbrae Art and Historical Society is a nonprofit organization that is dedicated to preserving and promoting Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history.\nThe Millbrae Art and Historical Society is located at 100 El Camino Real in Millbrae, California. The society is open Monday through Friday from 9 a.m. to 4 p.m. and on Saturday from 10 a.m. to 2 p.m. The society’s mailing address is P.O. Box 7141, Millbrae, CA 94020.\nThe Millbrae Art and Historical Society is a great place to learn about Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history. The society is open Monday through Friday from 9 a.m. to 4 p.m. and on Saturday from 10 a.m. to 2 p.m.\nMillbrae is a small town with a lot to offer residents and visitors. The town has a variety of activities, including a number of parks, a bayfront pier and a farmers’ market. The town is also home to the Millbrae Art and Historical Society, which is dedicated to preserving and promoting Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history.\nMillbrae is a great place to live, work and play. Millbrae has a variety of activities, including a number of parks, a bayfront pier and a farmers’ market. The town is also home to the Millbrae Art and Historical Society, which is dedicated to preserving and promoting Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history.\nThe Millbrae Art and Historical Society is a great place to learn about Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history. The society is open Monday through Friday from 9 a.m. to 4 p.m. and on Saturday from 10 a.m. to 2 p.m.\nMillbrae is a great place to live, work and play. The town is home to the Millbrae Art and Historical Society, which is dedicated to preserving and promoting Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history. The society is open Monday through Friday from 9 a.m. to 4 p.m. and on Saturday from 10 a.m. to 2 p.m.\nMillbrae is a great place to live, work and play. The town has a variety of activities, including a number of parks, a bayfront pier and a farmers’ market. The town is also home to the Millbrae Art and Historical Society, which is dedicated to preserving and promoting Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history. The society is open Monday through Friday from 9 a.m. to 4 p.m. and on Saturday from 10 a.m. to 2 p.m.\nThe Millbrae Art and Historical Society is a great place to learn about Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history.\nThe Millbrae Art and Historical Society is located at 100 El Camino Real in Millbrae, California. The society is open Monday through Friday from 9 a.m. to 4 p.m. and on Saturday from 10 a.m. to 2 p.m. The society’s mailing address is P.O. Box 7141, Millbrae, CA 94020.\nThe Millbrae Art and Historical Society is a great place to learn about Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history. The society is open Monday through Friday from 9 a.m. to 4 p.m. and on Saturday from 10 a.m. to 2 p.m.\nThe Millbrae Art and Historical Society is a nonprofit organization that is dedicated to preserving and promoting Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history.\nThe Millbrae Art and Historical Society is a great place to learn about Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history. The society is open Monday through Friday from 9 a.m. to 4 p.m. and on Saturday from 10 a.m. to 2 p.m.\nThe Millbrae Art and Historical Society is a great place to learn about Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history. The society is open Monday through Friday from 9 a.m. to 4 p.m. and on Saturday from 10 a.m. to 2 p.m. The society’s mailing address is P.O. Box 7141, Millbrae, CA 94020.\nThe Millbrae Art and Historical Society is a nonprofit organization that is dedicated to preserving and promoting Millbrae’s history. The society provides educational programs and events, and it also publishes a newsletter and a book about Millbrae’s history. The society is open Monday through Friday from 9 a.m. to 4 p.m. and on Saturday from 10 a.m. to 2 p.m."
        }
    ]
}
Perform Streaming Completion
URL: /_inference/completion/google-model-garden-meta-completion-2/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "input": "The sky above the port was the color of television tuned to a dead channel."
}
RS:
event: message
data: {"completion":[{"delta":"\n"}]}

event: message
data: {"completion":[{"delta":"In"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: [DONE]
Create Chat Completion Endpoint
URL: /_inference/chat_completion/google-model-garden-meta-chat-completion-2?timeout=5m
Method: PUT
Status Code: 200 OK
RQ:
{
    "service": "googlevertexai",
    "service_settings": {
        "provider": "meta",
        "service_account_json": "service_account_json",
        "streaming_url": "streaming_url"
    }
}
RS:
{
    "inference_id": "google-model-garden-meta-chat-completion-2",
    "task_type": "chat_completion",
    "service": "googlevertexai",
    "service_settings": {
        "streaming_url": "streaming_url",
        "provider": "META",
        "rate_limit": {
            "requests_per_minute": 1000
        }
    }
}
Perform Basic Chat Completion
URL: /_inference/chat_completion/google-model-garden-meta-chat-completion-2/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "messages": [
        {
            "role": "user",
            "content": "What is deep learning?"
        }
    ],
    "max_completion_tokens": 100
}
RS:
event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"role":"assistant"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"\n"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"["},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"INST"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"]"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Gu"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"ided"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Tour"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" through"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Deep"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Learning"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" ["},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"/"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"INST"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"]"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"\n"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"["},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"INST"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"]"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Deep"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Learning"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" in"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Pract"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"ice"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" -"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" A"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Case"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Study"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" ["},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"/"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"INST"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"]"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"\n"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"["},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"INST"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"]"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Building"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" a"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Deep"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Learning"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" System"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" ["},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"/"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"INST"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"]"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"\n"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"["},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"INST"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"]"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Deep"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Learning"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" with"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Python"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" ["},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"/"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"INST"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"]"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"\n"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"["},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"INST"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"]"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Deep"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Learning"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" from"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Sc"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"r"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"atch"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" ["},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"/"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"INST"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"]"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"\n"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"["},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"INST"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"]"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" The"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Deep"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Learning"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Revolution"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" ["},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"/"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"INST"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"]"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"\n"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"["},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"INST"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"]"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" From"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Ex"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"pl"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"or"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"atory"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Data"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Analysis"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" to"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Deep"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" Learning"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":" ["},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"/"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"INST"},"index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk"}

event: message
data: {"id":"cmpl-3047ab422326450fab58512463f09e71","choices":[{"delta":{"content":"]"},"finish_reason":"length","index":0}],"model":"meta-llama/Llama-2-7b-hf","object":"chat.completion.chunk","usage":{"completion_tokens":100,"prompt_tokens":13,"total_tokens":113}}

event: message
data: [DONE]
Perform Complex Chat Completion

Server Error is caused by the endpoint capabilities and not the integration itself.

URL: /_inference/chat_completion/google-model-garden-meta-chat-completion-2/_stream?timeout=5m
Method: POST
Status Code: 400 Bad Request
RQ:
{
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "What's the price of a scarf?"
                }
            ]
        }
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "get_current_price",
                "description": "Get the current price of a item",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "item": {
                            "id": "123"
                        }
                    }
                }
            }
        }
    ]
}
RS:
event: error
data: {"error":{"code":"bad_request","message":"Received a server error status code for request from inference entity id [google-model-garden-meta-chat-completion-2] status [500]. Error message: [Internal Server Error]","type":"llama_error"}}
  • - Have you signed the contributor license agreement?
  • - Have you followed the contributor guidelines?
  • - If submitting code, have you built your formula locally prior to submission with gradle check?
  • - If submitting code, is your pull request against main? Unless there is a good reason otherwise, we prefer pull requests against main and will backport as needed.
  • - If submitting code, have you checked that your submission is for an OS and architecture that we support?
  • - If you are submitting this code for a class then read our policy for that.

…n requests

- Refactor Mistral, Ai21, Llama, and Hugging Face request entities to accept model IDs.
- Update GoogleVertexAiActionCreator to handle multiple providers including META, HUGGING_FACE, MISTRAL, and AI21.
- Enhance serialization tests for model ID handling in chat completion requests.
- Introduce new response handlers for each Google Model Garden provider.
@elasticsearchmachine elasticsearchmachine added v9.2.0 needs:triage Requires assignment of a team area label external-contributor Pull request authored by a developer outside the Elasticsearch team labels Sep 30, 2025
…ai-providers-integration' into feature/google-model-garden-openai-providers-integration
@Jan-Kazlouski-elastic
Copy link
Contributor Author

Hugging Face (Dedicated Endpoint)

Create Completion Endpoint
URL: /_inference/completion/google-model-garden-hf-completion-1?timeout=5m
Method: PUT
Status Code: 200 OK
RQ:
{
    "service": "googlevertexai",
    "service_settings": {
        "provider": "hugging_face",
        "service_account_json": "service_account_json",
        "url": "url"
    }
}
RS:
{
    "inference_id": "google-model-garden-hf-completion-1",
    "task_type": "completion",
    "service": "googlevertexai",
    "service_settings": {
        "url": "url",
        "provider": "HUGGING_FACE",
        "rate_limit": {
            "requests_per_minute": 1000
        }
    }
}
Perform Non-Streaming Completion
URL: /_inference/completion/google-model-garden-hf-completion-1?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "input": "The sky above the port was the color of television tuned to a dead channel."
}
RS:
{
    "completion": [
        {
            "result": " This imaginative sentence sets a scene with a somber, bleak visual description, comparing the color of the sky over a port to the color one might see on a broken television screen, implying a stalled or lackluster vibe that pervades the atmosphere. The choice of words emphasizes the mundanity or perhaps the dystopian nature of the environment being described."
        }
    ]
}
Perform Streaming Completion
URL: /_inference/completion/google-model-garden-hf-completion-1/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "input": "The sky above the port was the color of television tuned to a dead channel."
}
RS:
event: message
data: {"completion":[{"delta":" ("}]}

event: message
data: {"completion":[{"delta":"This"}]}

event: message
data: {"completion":[{"delta":" is"}]}

event: message
data: {"completion":[{"delta":" an"}]}

event: message
data: {"completion":[{"delta":" id"}]}

event: message
data: {"completion":[{"delta":"iom"}]}

event: message
data: {"completion":[{"delta":"atic"}]}

event: message
data: {"completion":[{"delta":" expression"}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" doesn"}]}

event: message
data: {"completion":[{"delta":"'"}]}

event: message
data: {"completion":[{"delta":"t"}]}

event: message
data: {"completion":[{"delta":" have"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" literal"}]}

event: message
data: {"completion":[{"delta":" analysis"}]}

event: message
data: {"completion":[{"delta":" meant"}]}

event: message
data: {"completion":[{"delta":" for"}]}

event: message
data: {"completion":[{"delta":" fact"}]}

event: message
data: {"completion":[{"delta":"-"}]}

event: message
data: {"completion":[{"delta":"check"}]}

event: message
data: {"completion":[{"delta":"ing"}]}

event: message
data: {"completion":[{"delta":";"}]}

event: message
data: {"completion":[{"delta":" however"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" if"}]}

event: message
data: {"completion":[{"delta":" choosing"}]}

event: message
data: {"completion":[{"delta":" to"}]}

event: message
data: {"completion":[{"delta":" explore"}]}

event: message
data: {"completion":[{"delta":" its"}]}

event: message
data: {"completion":[{"delta":" imag"}]}

event: message
data: {"completion":[{"delta":"ery"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" one"}]}

event: message
data: {"completion":[{"delta":" might"}]}

event: message
data: {"completion":[{"delta":" encounter"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" sky"}]}

event: message
data: {"completion":[{"delta":" described"}]}

event: message
data: {"completion":[{"delta":" by"}]}

event: message
data: {"completion":[{"delta":" an"}]}

event: message
data: {"completion":[{"delta":" observer"}]}

event: message
data: {"completion":[{"delta":" with"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" po"}]}

event: message
data: {"completion":[{"delta":"ign"}]}

event: message
data: {"completion":[{"delta":"ant"}]}

event: message
data: {"completion":[{"delta":" or"}]}

event: message
data: {"completion":[{"delta":" ble"}]}

event: message
data: {"completion":[{"delta":"ak"}]}

event: message
data: {"completion":[{"delta":" view"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" possibly"}]}

event: message
data: {"completion":[{"delta":" reflect"}]}

event: message
data: {"completion":[{"delta":"ing"},{"delta":" an"}]}

event: message
data: {"completion":[{"delta":" industrial"}]}

event: message
data: {"completion":[{"delta":" or"}]}

event: message
data: {"completion":[{"delta":" d"}]}

event: message
data: {"completion":[{"delta":"yst"}]}

event: message
data: {"completion":[{"delta":"op"}]}

event: message
data: {"completion":[{"delta":"ian"}]}

event: message
data: {"completion":[{"delta":" amb"}]}

event: message
data: {"completion":[{"delta":"iance"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" rem"}]}

event: message
data: {"completion":[{"delta":"in"}]}

event: message
data: {"completion":[{"delta":"is"}]}

event: message
data: {"completion":[{"delta":"cent"}]}

event: message
data: {"completion":[{"delta":" of"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" monot"}]}

event: message
data: {"completion":[{"delta":"on"}]}

event: message
data: {"completion":[{"delta":"ous"}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" de"}]}

event: message
data: {"completion":[{"delta":"press"}]}

event: message
data: {"completion":[{"delta":"ing"}]}

event: message
data: {"completion":[{"delta":" static"}]}

event: message
data: {"completion":[{"delta":" on"}]}

event: message
data: {"completion":[{"delta":" an"}]}

event: message
data: {"completion":[{"delta":" un"}]}

event: message
data: {"completion":[{"delta":"used"}]}

event: message
data: {"completion":[{"delta":" television"}]}

event: message
data: {"completion":[{"delta":" screen"}]}

event: message
data: {"completion":[{"delta":".)"}]}

event: message
data: [DONE]

Create Chat Completion Endpoint
URL: /_inference/chat_completion/google-model-garden-hf-chat-completion-1?timeout=5m
Method: PUT
Status Code: 200 OK
RQ:
{
    "service": "googlevertexai",
    "service_settings": {
        "provider": "hugging_face",
        "service_account_json": "service_account_json",
        "streaming_url": "streaming_url"
    }
}
RS:
{
    "inference_id": "google-model-garden-hf-chat-completion-1",
    "task_type": "chat_completion",
    "service": "googlevertexai",
    "service_settings": {
        "streaming_url": "streaming_url",
        "provider": "HUGGING_FACE",
        "rate_limit": {
            "requests_per_minute": 1000
        }
    }
}
Perform Basic Chat Completion
URL: /_inference/chat_completion/google-model-garden-hf-chat-completion-1/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "messages": [
        {
            "role": "user",
            "content": "What is deep learning?"
        }
    ],
    "max_completion_tokens": 100
}
RS:
event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"","role":"assistant"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" Deep"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" learning"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" is"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" a"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" sub"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"field"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" of"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" machine"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" learning"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" that"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" focus"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"es"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" on"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" creating"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" systems"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" mode"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"led"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" after"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" the"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" human"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" brain"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"'"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"s"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" architecture"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"."},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" It"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" involves"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" using"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" neural"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" networks"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" with"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" multiple"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" layers"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" ("},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"h"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"ence"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" \""},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"deep"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"\")"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" to"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" extract"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" patterns"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" and"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" learn"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" from"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" data"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"."},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" These"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" artificial"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" neural"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" networks"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" ("},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"AN"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"N"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"s"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":")"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" consist"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" of"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" inter"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"connected"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" units"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" ("},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"nodes"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" or"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" neur"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"ons"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":")"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" organized"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" in"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" layers"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":","},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" similar"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" to"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" the"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" inter"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"connected"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" neur"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"ons"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" in"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" the"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" human"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" brain"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"."},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" Each"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" neur"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"on"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" performs"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" a"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" simple"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" computation"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":","},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" and"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" the"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" connections"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" between"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" neur"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":"ons"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" have"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" weights"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[{"delta":{"content":" that"},"finish_reason":"length","index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-100f3a81-d114-442b-bc8b-564c5a92e9b7","choices":[],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk","usage":{"completion_tokens":100,"prompt_tokens":8,"total_tokens":108}}

event: message
data: [DONE]
Perform Complex Chat Completion
URL: /_inference/chat_completion/google-model-garden-hf-chat-completion-1/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "What's the price of a scarf?"
                }
            ]
        }
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "get_current_price",
                "description": "Get the current price of a item",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "item": {
                            "id": "123"
                        }
                    }
                }
            }
        }
    ],
    "tool_choice": {
        "type": "function",
        "function": {
            "name": "get_current_price"
        }
    }
}
RS:
event: message
data: {"id":"chatcmpl-7f7c2fb0-9489-481e-a518-d2e01971e396","choices":[{"delta":{"content":"","role":"assistant"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-7f7c2fb0-9489-481e-a518-d2e01971e396","choices":[{"delta":{"tool_calls":[{"index":0,"id":"chatcmpl-tool-befd0725a2fb47b199eeb06437e40302","function":{"arguments":"{\"","name":"get_current_price"},"type":"function"}]},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-7f7c2fb0-9489-481e-a518-d2e01971e396","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"item"},"type":null}]},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-7f7c2fb0-9489-481e-a518-d2e01971e396","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""},"type":null}]},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-7f7c2fb0-9489-481e-a518-d2e01971e396","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"scar"},"type":null}]},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-7f7c2fb0-9489-481e-a518-d2e01971e396","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"f"},"type":null}]},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-7f7c2fb0-9489-481e-a518-d2e01971e396","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"},"type":null}]},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-7f7c2fb0-9489-481e-a518-d2e01971e396","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":""},"type":null}]},"finish_reason":"stop","index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-7f7c2fb0-9489-481e-a518-d2e01971e396","choices":[],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk","usage":{"completion_tokens":7,"prompt_tokens":13,"total_tokens":20}}

event: message
data: [DONE]

@Jan-Kazlouski-elastic
Copy link
Contributor Author

Hugging Face (Shared endpoint)

Create Completion Endpoint
URL: /_inference/completion/google-model-garden-hf-completion-2?timeout=5m
Method: PUT
Status Code: 200 OK
RQ:
{
    "service": "googlevertexai",
    "service_settings": {
        "provider": "hugging_face",
        "service_account_json": "service_account_json",
        "url": "url"
    }
}
RS:
{
    "inference_id": "google-model-garden-hf-completion-2",
    "task_type": "completion",
    "service": "googlevertexai",
    "service_settings": {
        "url": "url",
        "provider": "HUGGING_FACE",
        "rate_limit": {
            "requests_per_minute": 1000
        }
    }
}
Perform Non-Streaming Completion
URL: /_inference/completion/google-model-garden-hf-completion-2?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "input": "The sky above the port was the color of television tuned to a dead channel."
}
RS:
{
    "completion": [
        {
            "result": " This imaginative sentence sets a scene with a somber, bleak visual description, comparing the color of the sky over a port to the color one might see on a broken television screen, implying a stalled or lackluster vibe that pervades the atmosphere. The choice of words emphasizes the mundanity or perhaps the dystopian nature of the environment being described."
        }
    ]
}
Perform Streaming Completion
URL: /_inference/completion/google-model-garden-hf-completion-2/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "input": "The sky above the port was the color of television tuned to a dead channel."
}
RS:
event: message
data: {"completion":[{"delta":" ("}]}

event: message
data: {"completion":[{"delta":"This"}]}

event: message
data: {"completion":[{"delta":" is"}]}

event: message
data: {"completion":[{"delta":" an"}]}

event: message
data: {"completion":[{"delta":" id"}]}

event: message
data: {"completion":[{"delta":"iom"}]}

event: message
data: {"completion":[{"delta":"atic"}]}

event: message
data: {"completion":[{"delta":" expression"}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" doesn"}]}

event: message
data: {"completion":[{"delta":"'"}]}

event: message
data: {"completion":[{"delta":"t"}]}

event: message
data: {"completion":[{"delta":" have"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" literal"}]}

event: message
data: {"completion":[{"delta":" analysis"}]}

event: message
data: {"completion":[{"delta":" meant"}]}

event: message
data: {"completion":[{"delta":" for"}]}

event: message
data: {"completion":[{"delta":" fact"},{"delta":"-"}]}

event: message
data: {"completion":[{"delta":"check"}]}

event: message
data: {"completion":[{"delta":"ing"}]}

event: message
data: {"completion":[{"delta":";"}]}

event: message
data: {"completion":[{"delta":" however"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" if"}]}

event: message
data: {"completion":[{"delta":" choosing"}]}

event: message
data: {"completion":[{"delta":" to"}]}

event: message
data: {"completion":[{"delta":" explore"}]}

event: message
data: {"completion":[{"delta":" its"}]}

event: message
data: {"completion":[{"delta":" imag"},{"delta":"ery"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" one"}]}

event: message
data: {"completion":[{"delta":" might"}]}

event: message
data: {"completion":[{"delta":" encounter"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" sky"}]}

event: message
data: {"completion":[{"delta":" described"}]}

event: message
data: {"completion":[{"delta":" by"}]}

event: message
data: {"completion":[{"delta":" an"}]}

event: message
data: {"completion":[{"delta":" observer"}]}

event: message
data: {"completion":[{"delta":" with"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" po"}]}

event: message
data: {"completion":[{"delta":"ign"}]}

event: message
data: {"completion":[{"delta":"ant"}]}

event: message
data: {"completion":[{"delta":" or"}]}

event: message
data: {"completion":[{"delta":" ble"}]}

event: message
data: {"completion":[{"delta":"ak"}]}

event: message
data: {"completion":[{"delta":" view"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" possibly"}]}

event: message
data: {"completion":[{"delta":" reflect"}]}

event: message
data: {"completion":[{"delta":"ing"}]}

event: message
data: {"completion":[{"delta":" an"}]}

event: message
data: {"completion":[{"delta":" industrial"}]}

event: message
data: {"completion":[{"delta":" or"}]}

event: message
data: {"completion":[{"delta":" d"}]}

event: message
data: {"completion":[{"delta":"yst"}]}

event: message
data: {"completion":[{"delta":"op"}]}

event: message
data: {"completion":[{"delta":"ian"}]}

event: message
data: {"completion":[{"delta":" amb"}]}

event: message
data: {"completion":[{"delta":"iance"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" rem"}]}

event: message
data: {"completion":[{"delta":"in"}]}

event: message
data: {"completion":[{"delta":"is"}]}

event: message
data: {"completion":[{"delta":"cent"}]}

event: message
data: {"completion":[{"delta":" of"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" monot"}]}

event: message
data: {"completion":[{"delta":"on"}]}

event: message
data: {"completion":[{"delta":"ous"}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" de"}]}

event: message
data: {"completion":[{"delta":"press"},{"delta":"ing"}]}

event: message
data: {"completion":[{"delta":" static"}]}

event: message
data: {"completion":[{"delta":" on"}]}

event: message
data: {"completion":[{"delta":" an"}]}

event: message
data: {"completion":[{"delta":" un"}]}

event: message
data: {"completion":[{"delta":"used"}]}

event: message
data: {"completion":[{"delta":" television"}]}

event: message
data: {"completion":[{"delta":" screen"}]}

event: message
data: {"completion":[{"delta":".)"}]}

event: message
data: [DONE]
Create Chat Completion Endpoint
URL: /_inference/chat_completion/google-model-garden-hf-chat-completion-2?timeout=5m
Method: PUT
Status Code: 200 OK
RQ:
{
    "service": "googlevertexai",
    "service_settings": {
        "provider": "hugging_face",
        "service_account_json": "service_account_json",
        "streaming_url": "streaming_url"
    }
}
RS:
{
    "inference_id": "google-model-garden-hf-chat-completion-2",
    "task_type": "chat_completion",
    "service": "googlevertexai",
    "service_settings": {
        "streaming_url": "streaming_url",
        "provider": "HUGGING_FACE",
        "rate_limit": {
            "requests_per_minute": 1000
        }
    }
}
Perform Basic Chat Completion
URL: /_inference/chat_completion/google-model-garden-hf-chat-completion-2/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "messages": [
        {
            "role": "user",
            "content": "What is deep learning?"
        }
    ],
    "max_completion_tokens": 100
}
RS:
event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":"","role":"assistant"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" Deep"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" learning"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" is"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" a"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" subset"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" of"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" machine"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" learning"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":","},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" which"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" in"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" turn"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" is"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" a"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" subset"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" of"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" artificial"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" intelligence"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" ("},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":"AI"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":")."},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" It"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" is"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" concerned"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" with"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" algorithms"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" inspired"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" by"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" the"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" structure"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" and"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" function"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" of"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" the"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" brain"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" called"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" artificial"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" neural"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" networks"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":"."},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" Deep"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" learning"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" models"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" are"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" capable"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" of"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" learning"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" representations"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" of"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" data"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" with"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" multiple"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" levels"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" of"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" abstra"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":"ction"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":","},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" making"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" them"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" particularly"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" effective"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" for"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" tasks"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" such"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" as"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" image"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" and"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" speech"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" recognition"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":","},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" natural"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" language"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" processing"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":","},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" and"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" complex"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" game"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" playing"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":","},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" among"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" others"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":"."},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":"\n"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":"\n"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":"Un"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":"like"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" traditional"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" machine"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" learning"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" techniques"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":","},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" which"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" involve"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" hand"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":"-"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":"engine"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":"ering"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" features"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":","},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[{"delta":{"content":" deep"},"finish_reason":"length","index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-28c67921e4084d2d98b1d30b5e2316d9","choices":[],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk","usage":{"completion_tokens":100,"prompt_tokens":8,"total_tokens":108}}

event: message
data: [DONE]


Perform Complex Chat Completion
URL: /_inference/chat_completion/google-model-garden-hf-chat-completion-2/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "What's the price of a scarf?"
                }
            ]
        }
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "get_current_price",
                "description": "Get the current price of a item",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "item": {
                            "id": "123"
                        }
                    }
                }
            }
        }
    ],
    "tool_choice": {
        "type": "function",
        "function": {
            "name": "get_current_price"
        }
    }
}
RS:
event: message
data: {"id":"chatcmpl-9a85055bc5d44457bf45bef4d952a204","choices":[{"delta":{"content":"","role":"assistant"},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-9a85055bc5d44457bf45bef4d952a204","choices":[{"delta":{"tool_calls":[{"index":0,"id":"chatcmpl-tool-ebff2cc30d614327b1f317db1a29da94","function":{"arguments":"{\"","name":"get_current_price"},"type":"function"}]},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-9a85055bc5d44457bf45bef4d952a204","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"item"},"type":null}]},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-9a85055bc5d44457bf45bef4d952a204","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""},"type":null}]},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-9a85055bc5d44457bf45bef4d952a204","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"scar"},"type":null}]},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-9a85055bc5d44457bf45bef4d952a204","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"f"},"type":null}]},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-9a85055bc5d44457bf45bef4d952a204","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"},"type":null}]},"index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-9a85055bc5d44457bf45bef4d952a204","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":""},"type":null}]},"finish_reason":"stop","index":0}],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-9a85055bc5d44457bf45bef4d952a204","choices":[],"model":"gs://caip-tenant-1f582b58-2393-4ab7-92fd-f1ffed71b327/1121742653378002944/huggingface/microsoft/Phi-3-mini-4k-instruct/0a67737cc96d2554230f90338b163bc6380a2a85","object":"chat.completion.chunk","usage":{"completion_tokens":7,"prompt_tokens":13,"total_tokens":20}}

event: message
data: [DONE]

@Jan-Kazlouski-elastic
Copy link
Contributor Author

Mistral (Serverless)

Tested with mistral-small-2503

Create Completion Endpoint
URL: /_inference/completion/google-model-garden-mistral-completion-1?timeout=5m
Method: PUT
Status Code: 200 OK
RQ:
{
    "service": "googlevertexai",
    "service_settings": {
        "provider": "mistral",
        "model_id": "mistral-small-2503",
        "service_account_json": "service_account_json",
        "url": "rawPredict",
        "streaming_url": "streamRawPredict"
    }
}
RS:
{
    "inference_id": "google-model-garden-mistral-completion-1",
    "task_type": "completion",
    "service": "googlevertexai",
    "service_settings": {
        "model_id": "mistral-small-2503",
        "url": "https://us-central1-aiplatform.googleapis.com/v1/projects/1014491842772/locations/us-central1/publishers/mistralai/models/mistral-small-2503:rawPredict",
        "streaming_url": "https://us-central1-aiplatform.googleapis.com/v1/projects/1014491842772/locations/us-central1/publishers/mistralai/models/mistral-small-2503:streamRawPredict",
        "provider": "MISTRAL",
        "rate_limit": {
            "requests_per_minute": 1000
        }
    }
}
Perform Non-Streaming Completion
URL: /_inference/completion/google-model-garden-mistral-completion-1?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "input": "The sky above the port was the color of television tuned to a dead channel."
}
RS:
{
    "completion": [
        {
            "result": "This sentence is the opening line of William Gibson's seminal 1984 cyberpunk novel *Neuromancer*. It's a vivid and evocative description that sets the tone for the dystopian, high-tech, low-life world of the story. The \"color of television tuned to a dead channel\" is often interpreted as a static-like, grayish hue, which can evoke a sense of emptiness, decay, or the absence of clear signals or information. This imagery is fitting for a novel that explores themes of artificial intelligence, virtual reality, and the blurred lines between technology and humanity."
        }
    ]
}
Perform Streaming Completion
URL: /_inference/completion/google-model-garden-mistral-completion-1/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "input": "The sky above the port was the color of television tuned to a dead channel."
}
RS:
event: message
data: {"completion":[{"delta":"This"}]}

event: message
data: {"completion":[{"delta":" sentence"}]}

event: message
data: {"completion":[{"delta":" is the"}]}

event: message
data: {"completion":[{"delta":" opening"}]}

event: message
data: {"completion":[{"delta":" line of the"}]}

event: message
data: {"completion":[{"delta":" novel"}]}

event: message
data: {"completion":[{"delta":" *"}]}

event: message
data: {"completion":[{"delta":"Ne"}]}

event: message
data: {"completion":[{"delta":"u"}]}

event: message
data: {"completion":[{"delta":"romancer*"}]}

event: message
data: {"completion":[{"delta":" by William"}]}

event: message
data: {"completion":[{"delta":" Gibson. It"}]}

event: message
data: {"completion":[{"delta":"'s"}]}

event: message
data: {"completion":[{"delta":" a vivid"}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" evoc"}]}

event: message
data: {"completion":[{"delta":"ative description that"}]}

event: message
data: {"completion":[{"delta":" sets"}]}

event: message
data: {"completion":[{"delta":" the tone"}]}

event: message
data: {"completion":[{"delta":" for the cyber"}]}

event: message
data: {"completion":[{"delta":"punk world of"}]}

event: message
data: {"completion":[{"delta":" the story"}]}

event: message
data: {"completion":[{"delta":". Here"}]}

event: message
data: {"completion":[{"delta":"'s a brief"}]}

event: message
data: {"completion":[{"delta":" breakdown:\n\n- **\""}]}

event: message
data: {"completion":[{"delta":"The sky above the"}]}

event: message
data: {"completion":[{"delta":" port was the color"}]}

event: message
data: {"completion":[{"delta":" of television tuned to"}]}

event: message
data: {"completion":[{"delta":" a dead channel\""}]}

event: message
data: {"completion":[{"delta":"**:"}]}

event: message
data: {"completion":[{"delta":" This is"}]}

event: message
data: {"completion":[{"delta":" a metaphor"}]}

event: message
data: {"completion":[{"delta":"ical"}]}

event: message
data: {"completion":[{"delta":" description"}]}

event: message
data: {"completion":[{"delta":" of the sky."}]}

event: message
data: {"completion":[{"delta":" Instead"}]}

event: message
data: {"completion":[{"delta":" of being"}]}

event: message
data: {"completion":[{"delta":" a natural"}]}

event: message
data: {"completion":[{"delta":" blue"}]}

event: message
data: {"completion":[{"delta":" or"}]}

event: message
data: {"completion":[{"delta":" filled"}]}

event: message
data: {"completion":[{"delta":" with clouds"}]}

event: message
data: {"completion":[{"delta":", it's compared"}]}

event: message
data: {"completion":[{"delta":" to the"}]}

event: message
data: {"completion":[{"delta":" static"}]}

event: message
data: {"completion":[{"delta":" or"}]}

event: message
data: {"completion":[{"delta":" \""}]}

event: message
data: {"completion":[{"delta":"s"}]}

event: message
data: {"completion":[{"delta":"now"}]}

event: message
data: {"completion":[{"delta":"\" that"}]}

event: message
data: {"completion":[{"delta":" appears"}]}

event: message
data: {"completion":[{"delta":" on"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" television screen when"}]}

event: message
data: {"completion":[{"delta":" there"}]}

event: message
data: {"completion":[{"delta":"'s no signal"}]}

event: message
data: {"completion":[{"delta":". This"}]}

event: message
data: {"completion":[{"delta":" creates"}]}

event: message
data: {"completion":[{"delta":" an"}]}

event: message
data: {"completion":[{"delta":" image"}]}

event: message
data: {"completion":[{"delta":" of a dull"}]}

event: message
data: {"completion":[{"delta":", gray"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" lif"}]}

event: message
data: {"completion":[{"delta":"eless sky, which"}]}

event: message
data: {"completion":[{"delta":" can"}]}

event: message
data: {"completion":[{"delta":" evoke"}]}

event: message
data: {"completion":[{"delta":" feelings"}]}

event: message
data: {"completion":[{"delta":" of des"}]}

event: message
data: {"completion":[{"delta":"olation or"}]}

event: message
data: {"completion":[{"delta":" technological"}]}

event: message
data: {"completion":[{"delta":" decay"},{"delta":".\n\nThe"}]}

event: message
data: {"completion":[{"delta":" use"}]}

event: message
data: {"completion":[{"delta":" of this"}]}

event: message
data: {"completion":[{"delta":" imagery"}]}

event: message
data: {"completion":[{"delta":" helps"}]}

event: message
data: {"completion":[{"delta":" to establish"}]}

event: message
data: {"completion":[{"delta":" the dyst"}]}

event: message
data: {"completion":[{"delta":"opian,"}]}

event: message
data: {"completion":[{"delta":" high"}]}

event: message
data: {"completion":[{"delta":"-tech, and somewhat"}]}

event: message
data: {"completion":[{"delta":" ble"}]}

event: message
data: {"completion":[{"delta":"ak atmosphere that"}]}

event: message
data: {"completion":[{"delta":" is"}]}

event: message
data: {"completion":[{"delta":" characteristic"}]}

event: message
data: {"completion":[{"delta":" of the cyberpunk"}]}

event: message
data: {"completion":[{"delta":" genre"}]}

event: message
data: {"completion":[{"delta":"."}]}

event: message
data: [DONE]
Create Chat Completion Endpoint
URL: /_inference/chat_completion/google-model-garden-mistral-chat-completion-1?timeout=5m
Method: PUT
Status Code: 200 OK
RQ:
{
    "service": "googlevertexai",
    "service_settings": {
        "provider": "mistral",
        "model_id": "mistral-small-2503",
        "service_account_json": "service_account_json",
        "streaming_url": "streamRawPredict"
    }
}
RS:
{
    "inference_id": "google-model-garden-mistral-chat-completion-1",
    "task_type": "chat_completion",
    "service": "googlevertexai",
    "service_settings": {
        "model_id": "mistral-small-2503",
        "streaming_url": "streamRawPredict",
        "provider": "MISTRAL",
        "rate_limit": {
            "requests_per_minute": 1000
        }
    }
}
Perform Basic Chat Completion
URL: /_inference/chat_completion/google-model-garden-mistral-chat-completion-1/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "messages": [
        {
            "role": "user",
            "content": "What is deep learning?"
        }
    ],
    "max_completion_tokens": 100
}
RS:
event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":"","role":"assistant"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":"Deep"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" learning is"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" a subset of machine"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" learning that involves"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" the use of artificial"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" neural"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" networks with"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" many"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" layers ("},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":"h"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":"ence \""},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":"deep\")"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" to model"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" and"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" solve"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" complex"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" problems. These"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" neural"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" networks are inspired by"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" the structure"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" and"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" function of the"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" human brain, consisting"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" of interconnected"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" layers of nodes"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" or \""},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":"neurons.\" Each"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" layer"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" processes"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" input"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" data and"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" passes"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" the"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" output"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" to the next layer"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":", allowing"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" the"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" network to learn and"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" make decisions"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" based"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" on the data it"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" has been trained on"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":".\n\n### Key Components"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":" of Deep Learning:\n\n"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"ea01f6482d5c4a769e29a2426c56872f","choices":[{"delta":{"content":"1. **"},"finish_reason":"length","index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk","usage":{"completion_tokens":100,"prompt_tokens":8,"total_tokens":108}}

event: message
data: [DONE]
Perform Complex Chat Completion
URL: /_inference/chat_completion/google-model-garden-mistral-chat-completion-1/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "What's the price of a scarf?"
                }
            ]
        }
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "get_current_price",
                "description": "Get the current price of a item",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "item": {
                            "id": "123"
                        }
                    }
                }
            }
        }
    ],
    "tool_choice": {
        "type": "function",
        "function": {
            "name": "get_current_price"
        }
    }
}
RS:
event: message
data: {"id":"c3c9525bb4834cbf8efe62a3c6b4dbe5","choices":[{"delta":{"content":"","role":"assistant"},"index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk"}

event: message
data: {"id":"c3c9525bb4834cbf8efe62a3c6b4dbe5","choices":[{"delta":{"tool_calls":[{"index":0,"id":"pDElkmFZe","function":{"arguments":"{\"item\": \"scarf\"}","name":"get_current_price"},"type":null}]},"finish_reason":"tool_calls","index":0}],"model":"mistral-small-2503","object":"chat.completion.chunk","usage":{"completion_tokens":23,"prompt_tokens":79,"total_tokens":102}}

event: message
data: [DONE]

@Jan-Kazlouski-elastic
Copy link
Contributor Author

Mistral (Dedicated endpoint)

Create Completion Endpoint
URL: /_inference/completion/google-model-garden-mistral-completion-2?timeout=5m
Method: PUT
Status Code: 200 OK
RQ:
{
    "service": "googlevertexai",
    "service_settings": {
        "provider": "mistral",
        "service_account_json": "service_account_json",
        "url": "url"
    }
}
RS:
{
    "inference_id": "google-model-garden-mistral-completion-2",
    "task_type": "completion",
    "service": "googlevertexai",
    "service_settings": {
        "url": "url",
        "provider": "MISTRAL",
        "rate_limit": {
            "requests_per_minute": 1000
        }
    }
}
Perform Non-Streaming Completion
URL: /_inference/completion/google-model-garden-mistral-completion-2?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "input": "The sky above the port was the color of television tuned to a dead channel."
}
RS:
{
    "completion": [
        {
            "result": " That's a beautiful description, evoking a sense of tranquility and melancholy at the same time. It's as if the sky is a reflection of our own emotions, sometimes vibrant and full of life, other times dull and uninspiring. Is there anything specific you would like me to help you find information about?"
        }
    ]
}
Perform Streaming Completion
URL: /_inference/completion/google-model-garden-mistral-completion-2/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "input": "The sky above the port was the color of television tuned to a dead channel."
}
RS:
event: message
data: {"completion":[{"delta":" That"}]}

event: message
data: {"completion":[{"delta":"'"}]}

event: message
data: {"completion":[{"delta":"s"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" beautiful"}]}

event: message
data: {"completion":[{"delta":" description"}]}

event: message
data: {"completion":[{"delta":"."}]}

event: message
data: {"completion":[{"delta":" It"},{"delta":" pain"}]}

event: message
data: {"completion":[{"delta":"ts"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" vivid"}]}

event: message
data: {"completion":[{"delta":" picture"}]}

event: message
data: {"completion":[{"delta":" of"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" sky"}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" creates"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" mood"}]}

event: message
data: {"completion":[{"delta":"y"}]}

event: message
data: {"completion":[{"delta":" atmosphere"}]}

event: message
data: {"completion":[{"delta":"."}]}

event: message
data: {"completion":[{"delta":" The"}]}

event: message
data: {"completion":[{"delta":" image"}]}

event: message
data: {"completion":[{"delta":" of"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" dead"}]}

event: message
data: {"completion":[{"delta":" television"}]}

event: message
data: {"completion":[{"delta":" channel"}]}

event: message
data: {"completion":[{"delta":" adds"}]}

event: message
data: {"completion":[{"delta":" an"}]}

event: message
data: {"completion":[{"delta":" element"}]}

event: message
data: {"completion":[{"delta":" of"}]}

event: message
data: {"completion":[{"delta":" nost"}]}

event: message
data: {"completion":[{"delta":"alg"}]}

event: message
data: {"completion":[{"delta":"ia"}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" sense"}]}

event: message
data: {"completion":[{"delta":" of"},{"delta":" something"}]}

event: message
data: {"completion":[{"delta":" being"}]}

event: message
data: {"completion":[{"delta":" lost"}]}

event: message
data: {"completion":[{"delta":" or"}]}

event: message
data: {"completion":[{"delta":" forgotten"}]}

event: message
data: {"completion":[{"delta":"."}]}

event: message
data: {"completion":[{"delta":" It"}]}

event: message
data: {"completion":[{"delta":"'"}]}

event: message
data: {"completion":[{"delta":"s"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" great"}]}

event: message
data: {"completion":[{"delta":" example"}]}

event: message
data: {"completion":[{"delta":" of"}]}

event: message
data: {"completion":[{"delta":" how"}]}

event: message
data: {"completion":[{"delta":" language"}]}

event: message
data: {"completion":[{"delta":" can"}]}

event: message
data: {"completion":[{"delta":" be"}]}

event: message
data: {"completion":[{"delta":" used"}]}

event: message
data: {"completion":[{"delta":" to"}]}

event: message
data: {"completion":[{"delta":" create"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" specific"}]}

event: message
data: {"completion":[{"delta":" image"}]}

event: message
data: {"completion":[{"delta":" or"}]}

event: message
data: {"completion":[{"delta":" feeling"}]}

event: message
data: {"completion":[{"delta":" in"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" reader"}]}

event: message
data: {"completion":[{"delta":"'"}]}

event: message
data: {"completion":[{"delta":"s"}]}

event: message
data: {"completion":[{"delta":" mind"}]}

event: message
data: {"completion":[{"delta":"."}]}

event: message
data: [DONE]
Create Chat Completion Endpoint
URL: /_inference/chat_completion/google-model-garden-mistral-chat-completion-2?timeout=5m
Method: PUT
Status Code: 200 OK
RQ:
{
    "service": "googlevertexai",
    "service_settings": {
        "provider": "mistral",
        "service_account_json": "service_account_json",
        "streaming_url": "streaming_url"
    }
}
RS:
{
    "inference_id": "google-model-garden-mistral-chat-completion-2",
    "task_type": "chat_completion",
    "service": "googlevertexai",
    "service_settings": {
        "streaming_url": "streaming_url",
        "provider": "MISTRAL",
        "rate_limit": {
            "requests_per_minute": 1000
        }
    }
}
Perform Basic Chat Completion
URL: /_inference/chat_completion/google-model-garden-mistral-chat-completion-2/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "messages": [
        {
            "role": "user",
            "content": "What is deep learning?"
        }
    ],
    "max_completion_tokens": 100
}
RS:
event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"","role":"assistant"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" Deep"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" learning"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" is"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" a"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" subset"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" of"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" machine"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" learning"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":","},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" which"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" is"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" itself"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" a"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" subset"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" of"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" artificial"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" intelligence"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" ("},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"AI"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":")."},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" It"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" ent"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"ails"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" neural"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" networks"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" with"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" many"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" layers"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":","},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" hence"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" the"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" \""},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"deep"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"\""},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" in"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" deep"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" learning"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"."},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" These"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" deep"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" neural"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" networks"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" ("},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"D"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"NN"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"s"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":")"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" are"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" at"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" the"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" fore"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"front"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" of"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" a"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" techn"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"ological"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" revolution"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" in"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" how"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" computers"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" understand"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" and"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" process"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" data"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"."},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" Un"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"like"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" traditional"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" machine"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" learning"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" techniques"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":","},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" deep"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" learning"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" algorithms"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" can"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" automatically"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" discover"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" and"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" learn"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" representations"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" of"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" data"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" by"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" considering"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" different"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" levels"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" of"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" abstra"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"ction"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":"."},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" These"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" representations"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" make"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" deep"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" learning"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" particularly"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" effective"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" for"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-274b0b82-5573-49e2-ae41-5b02ea3aaafe","choices":[{"delta":{"content":" complex"},"finish_reason":"length","index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: [DONE]
Perform Complex Chat Completion
URL: /_inference/chat_completion/google-model-garden-mistral-chat-completion-2/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "What's the price of a scarf?"
                }
            ]
        }
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "get_current_price",
                "description": "Get the current price of a item",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "item": {
                            "id": "123"
                        }
                    }
                }
            }
        }
    ],
    "tool_choice": {
        "type": "function",
        "function": {
            "name": "get_current_price"
        }
    }
}
RS:
event: message
data: {"id":"chatcmpl-2a137b75-2fc3-41f0-8ede-13e02b671b67","choices":[{"delta":{"content":"","role":"assistant"},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-2a137b75-2fc3-41f0-8ede-13e02b671b67","choices":[{"delta":{"tool_calls":[{"index":0,"id":"chatcmpl-tool-247ebd8a96364c94a3ca127528a1bca7","function":{"arguments":"{\"","name":"get_current_price"},"type":"function"}]},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-2a137b75-2fc3-41f0-8ede-13e02b671b67","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"item"},"type":null}]},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-2a137b75-2fc3-41f0-8ede-13e02b671b67","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""},"type":null}]},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-2a137b75-2fc3-41f0-8ede-13e02b671b67","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"scar"},"type":null}]},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-2a137b75-2fc3-41f0-8ede-13e02b671b67","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"f"},"type":null}]},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-2a137b75-2fc3-41f0-8ede-13e02b671b67","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"},"type":null}]},"index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: {"id":"chatcmpl-2a137b75-2fc3-41f0-8ede-13e02b671b67","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":""},"type":null}]},"finish_reason":"stop","index":0}],"model":"microsoft/Phi-3-mini-4k-instruct","object":"chat.completion.chunk"}

event: message
data: [DONE]

@Jan-Kazlouski-elastic
Copy link
Contributor Author

Ai21 (Serverless)

Create Completion Endpoint
URL: /_inference/completion/google-model-garden-ai21-completion-1?timeout=5m
Method: PUT
Status Code: 200 OK
RQ:
{
    "service": "googlevertexai",
    "service_settings": {
        "provider": "ai21",
        "service_account_json": "service_account_json",
        "url": "rawPredict",
        "streaming_url": "streamRawPredict"
    }
}
RS:
{
    "inference_id": "google-model-garden-ai21-completion-1",
    "task_type": "completion",
    "service": "googlevertexai",
    "service_settings": {
        "url": "rawPredict",
        "streaming_url": "streamRawPredict",
        "provider": "AI21",
        "rate_limit": {
            "requests_per_minute": 1000
        }
    }
}
Perform Non-Streaming Completion
URL: /_inference/completion/google-model-garden-ai21-completion-1?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "input": "The sky above the port was the color of television tuned to a dead channel."
}
RS:
{
    "completion": [
        {
            "result": " This line is from William Gibson's groundbreaking cyberpunk novel *Neuromancer*, published in 1984. It sets a vivid and evocative scene, capturing the gritty, dystopian atmosphere of the novel's setting. The imagery of a \"dead channel\" on a television screen evokes a sense of desolation and decay, while the comparison to the sky adds a surreal, almost apocalyptic quality to the environment. This line encapsulates the novel's themes of technology, decay, and the blurred lines between reality and virtuality."
        }
    ]
}
Perform Streaming Completion
URL: /_inference/completion/google-model-garden-ai21-completion-1/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "input": "The sky above the port was the color of television tuned to a dead channel."
}
RS:
event: message
data: {"completion":[{"delta":" The"}]}

event: message
data: {"completion":[{"delta":" line"}]}

event: message
data: {"completion":[{"delta":" \""}]}

event: message
data: {"completion":[{"delta":"The"}]}

event: message
data: {"completion":[{"delta":" sky"}]}

event: message
data: {"completion":[{"delta":" above"},{"delta":" the"},{"delta":" port"}]}

event: message
data: {"completion":[{"delta":" was"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" color"}]}

event: message
data: {"completion":[{"delta":" of"}]}

event: message
data: {"completion":[{"delta":" television"}]}

event: message
data: {"completion":[{"delta":" tuned"}]}

event: message
data: {"completion":[{"delta":" to"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" dead"}]}

event: message
data: {"completion":[{"delta":" channel"}]}

event: message
data: {"completion":[{"delta":"\""}]}

event: message
data: {"completion":[{"delta":" is"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" famous"}]}

event: message
data: {"completion":[{"delta":" quote"}]}

event: message
data: {"completion":[{"delta":" from"}]}

event: message
data: {"completion":[{"delta":" William"}]}

event: message
data: {"completion":[{"delta":" Gibson"}]}

event: message
data: {"completion":[{"delta":"'"}]}

event: message
data: {"completion":[{"delta":"s"}]}

event: message
data: {"completion":[{"delta":" groundbreaking"}]}

event: message
data: {"completion":[{"delta":" cyber"}]}

event: message
data: {"completion":[{"delta":"punk"}]}

event: message
data: {"completion":[{"delta":" novel"}]}

event: message
data: {"completion":[{"delta":" *"}]}

event: message
data: {"completion":[{"delta":"Ne"}]}

event: message
data: {"completion":[{"delta":"ur"}]}

event: message
data: {"completion":[{"delta":"om"}]}

event: message
data: {"completion":[{"delta":"ancer"}]}

event: message
data: {"completion":[{"delta":"*."}]}

event: message
data: {"completion":[{"delta":" This"}]}

event: message
data: {"completion":[{"delta":" opening"}]}

event: message
data: {"completion":[{"delta":" line"}]}

event: message
data: {"completion":[{"delta":" sets"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" tone"}]}

event: message
data: {"completion":[{"delta":" for"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" novel"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" introducing"}]}

event: message
data: {"completion":[{"delta":" readers"}]}

event: message
data: {"completion":[{"delta":" to"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" dyst"}]}

event: message
data: {"completion":[{"delta":"opian"}]}

event: message
data: {"completion":[{"delta":" future"}]}

event: message
data: {"completion":[{"delta":" filled"}]}

event: message
data: {"completion":[{"delta":" with"}]}

event: message
data: {"completion":[{"delta":" advanced"}]}

event: message
data: {"completion":[{"delta":" technology"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" gritty"}]}

event: message
data: {"completion":[{"delta":" urban"}]}

event: message
data: {"completion":[{"delta":" landscapes"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" sense"}]}

event: message
data: {"completion":[{"delta":" of"}]}

event: message
data: {"completion":[{"delta":" dis"}]}

event: message
data: {"completion":[{"delta":"illusion"}]}

event: message
data: {"completion":[{"delta":"ment"}]}

event: message
data: {"completion":[{"delta":"."}]}

event: message
data: {"completion":[{"delta":"\n"}]}

event: message
data: {"completion":[{"delta":"\n"}]}

event: message
data: {"completion":[{"delta":"In"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" context"}]}

event: message
data: {"completion":[{"delta":" of"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" novel"},{"delta":","},{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" phrase"}]}

event: message
data: {"completion":[{"delta":" reflects"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" polluted"}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" artificial"}]}

event: message
data: {"completion":[{"delta":" environment"}]}

event: message
data: {"completion":[{"delta":" of"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" world"}]}

event: message
data: {"completion":[{"delta":" Gibson"}]}

event: message
data: {"completion":[{"delta":" depicts"}]}

event: message
data: {"completion":[{"delta":"."}]}

event: message
data: {"completion":[{"delta":" The"}]}

event: message
data: {"completion":[{"delta":" \""}]}

event: message
data: {"completion":[{"delta":"dead"}]}

event: message
data: {"completion":[{"delta":" channel"}]}

event: message
data: {"completion":[{"delta":"\""}]}

event: message
data: {"completion":[{"delta":" imagery"}]}

event: message
data: {"completion":[{"delta":" evokes"}]}

event: message
data: {"completion":[{"delta":" a"}]}

event: message
data: {"completion":[{"delta":" sense"}]}

event: message
data: {"completion":[{"delta":" of"}]}

event: message
data: {"completion":[{"delta":" decay"}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" emptiness"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" highlighting"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" bleak"}]}

event: message
data: {"completion":[{"delta":"ness"}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" lack"}]}

event: message
data: {"completion":[{"delta":" of"}]}

event: message
data: {"completion":[{"delta":" natural"}]}

event: message
data: {"completion":[{"delta":" beauty"}]}

event: message
data: {"completion":[{"delta":" in"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" world"}]}

event: message
data: {"completion":[{"delta":"."}]}

event: message
data: {"completion":[{"delta":" It"}]}

event: message
data: {"completion":[{"delta":" also"}]}

event: message
data: {"completion":[{"delta":" fores"}]}

event: message
data: {"completion":[{"delta":"h"}]}

event: message
data: {"completion":[{"delta":"adows"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" themes"}]}

event: message
data: {"completion":[{"delta":" of"}]}

event: message
data: {"completion":[{"delta":" virtual"}]}

event: message
data: {"completion":[{"delta":" reality"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" artificial"}]}

event: message
data: {"completion":[{"delta":" intelligence"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" blurred"}]}

event: message
data: {"completion":[{"delta":" lines"}]}

event: message
data: {"completion":[{"delta":" between"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" real"}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" simulated"}]}

event: message
data: {"completion":[{"delta":" that"}]}

event: message
data: {"completion":[{"delta":" perme"}]}

event: message
data: {"completion":[{"delta":"ate"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" novel"}]}

event: message
data: {"completion":[{"delta":"."}]}

event: message
data: {"completion":[{"delta":"\n"}]}

event: message
data: {"completion":[{"delta":"\n"}]}

event: message
data: {"completion":[{"delta":"This"}]}

event: message
data: {"completion":[{"delta":" line"}]}

event: message
data: {"completion":[{"delta":" has"}]}

event: message
data: {"completion":[{"delta":" become"}]}

event: message
data: {"completion":[{"delta":" iconic"}]}

event: message
data: {"completion":[{"delta":" in"}]}

event: message
data: {"completion":[{"delta":" science"}]}

event: message
data: {"completion":[{"delta":" fiction"}]}

event: message
data: {"completion":[{"delta":" literature"}]}

event: message
data: {"completion":[{"delta":","}]}

event: message
data: {"completion":[{"delta":" often"}]}

event: message
data: {"completion":[{"delta":" cited"}]}

event: message
data: {"completion":[{"delta":" for"}]}

event: message
data: {"completion":[{"delta":" its"}]}

event: message
data: {"completion":[{"delta":" evoc"}]}

event: message
data: {"completion":[{"delta":"ative"}]}

event: message
data: {"completion":[{"delta":" imagery"}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" its"}]}

event: message
data: {"completion":[{"delta":" encaps"}]}

event: message
data: {"completion":[{"delta":"ulation"}]}

event: message
data: {"completion":[{"delta":" of"}]}

event: message
data: {"completion":[{"delta":" the"}]}

event: message
data: {"completion":[{"delta":" cyber"}]}

event: message
data: {"completion":[{"delta":"punk"}]}

event: message
data: {"completion":[{"delta":" genre"}]}

event: message
data: {"completion":[{"delta":"'"}]}

event: message
data: {"completion":[{"delta":"s"}]}

event: message
data: {"completion":[{"delta":" aesthetic"}]}

event: message
data: {"completion":[{"delta":" and"}]}

event: message
data: {"completion":[{"delta":" thematic"}]}

event: message
data: {"completion":[{"delta":" concerns"}]}

event: message
data: {"completion":[{"delta":"."}]}

event: message
data: [DONE]
Create Chat Completion Endpoint
URL: /_inference/chat_completion/google-model-garden-ai21-chat-completion-1?timeout=5m
Method: PUT
Status Code: 200 OK
RQ:
{
    "service": "googlevertexai",
    "service_settings": {
        "provider": "ai21",
        "service_account_json": "service_account_json",
        "streaming_url": "streamRawPredict"
    }
}
RS:
{
    "inference_id": "google-model-garden-ai21-chat-completion-1",
    "task_type": "chat_completion",
    "service": "googlevertexai",
    "service_settings": {
        "streaming_url": "streamRawPredict",
        "provider": "AI21",
        "rate_limit": {
            "requests_per_minute": 1000
        }
    }
}
Perform Basic Chat Completion
URL: /_inference/chat_completion/google-model-garden-ai21-chat-completion-1/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "messages": [
        {
            "role": "user",
            "content": "What is deep learning?"
        }
    ],
    "max_completion_tokens": 100
}
RS:
event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":"","role":"assistant"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":0,"prompt_tokens":15,"total_tokens":15}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" Deep"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":1,"prompt_tokens":15,"total_tokens":16}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" learning"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":2,"prompt_tokens":15,"total_tokens":17}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" is"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":3,"prompt_tokens":15,"total_tokens":18}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" a"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":4,"prompt_tokens":15,"total_tokens":19}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" subset"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":5,"prompt_tokens":15,"total_tokens":20}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" of"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":6,"prompt_tokens":15,"total_tokens":21}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" machine"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":7,"prompt_tokens":15,"total_tokens":22}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" learning"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":8,"prompt_tokens":15,"total_tokens":23}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":","},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":9,"prompt_tokens":15,"total_tokens":24}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" which"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":10,"prompt_tokens":15,"total_tokens":25}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" is"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":11,"prompt_tokens":15,"total_tokens":26}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" itself"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":12,"prompt_tokens":15,"total_tokens":27}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" a"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":13,"prompt_tokens":15,"total_tokens":28}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" subset"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":14,"prompt_tokens":15,"total_tokens":29}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" of"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":15,"prompt_tokens":15,"total_tokens":30}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" artificial"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":16,"prompt_tokens":15,"total_tokens":31}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" intelligence"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":17,"prompt_tokens":15,"total_tokens":32}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" ("},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":18,"prompt_tokens":15,"total_tokens":33}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":"AI"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":19,"prompt_tokens":15,"total_tokens":34}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":")."},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":20,"prompt_tokens":15,"total_tokens":35}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" It"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":21,"prompt_tokens":15,"total_tokens":36}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" involves"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":22,"prompt_tokens":15,"total_tokens":37}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" training"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":23,"prompt_tokens":15,"total_tokens":38}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" artificial"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":24,"prompt_tokens":15,"total_tokens":39}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" neural"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":25,"prompt_tokens":15,"total_tokens":40}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" networks"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":26,"prompt_tokens":15,"total_tokens":41}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":","},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":27,"prompt_tokens":15,"total_tokens":42}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" which"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":28,"prompt_tokens":15,"total_tokens":43}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" are"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":29,"prompt_tokens":15,"total_tokens":44}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" computational"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":30,"prompt_tokens":15,"total_tokens":45}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" models"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":31,"prompt_tokens":15,"total_tokens":46}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" inspired"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":32,"prompt_tokens":15,"total_tokens":47}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" by"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":33,"prompt_tokens":15,"total_tokens":48}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" the"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":34,"prompt_tokens":15,"total_tokens":49}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" human"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":35,"prompt_tokens":15,"total_tokens":50}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" brain"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":36,"prompt_tokens":15,"total_tokens":51}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":","},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":37,"prompt_tokens":15,"total_tokens":52}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" to"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":38,"prompt_tokens":15,"total_tokens":53}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" recognize"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":39,"prompt_tokens":15,"total_tokens":54}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" patterns"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":40,"prompt_tokens":15,"total_tokens":55}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" and"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":41,"prompt_tokens":15,"total_tokens":56}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" make"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":42,"prompt_tokens":15,"total_tokens":57}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" decisions"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":43,"prompt_tokens":15,"total_tokens":58}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":"."},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":44,"prompt_tokens":15,"total_tokens":59}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" Here"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":45,"prompt_tokens":15,"total_tokens":60}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" are"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":46,"prompt_tokens":15,"total_tokens":61}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" some"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":47,"prompt_tokens":15,"total_tokens":62}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" key"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":48,"prompt_tokens":15,"total_tokens":63}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" points"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":49,"prompt_tokens":15,"total_tokens":64}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" about"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":50,"prompt_tokens":15,"total_tokens":65}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" deep"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":51,"prompt_tokens":15,"total_tokens":66}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" learning"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":52,"prompt_tokens":15,"total_tokens":67}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":":"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":53,"prompt_tokens":15,"total_tokens":68}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":"\n"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":54,"prompt_tokens":15,"total_tokens":69}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":"\n"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":55,"prompt_tokens":15,"total_tokens":70}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":"1"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":56,"prompt_tokens":15,"total_tokens":71}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":"."},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":57,"prompt_tokens":15,"total_tokens":72}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" **"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":58,"prompt_tokens":15,"total_tokens":73}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":"Ne"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":59,"prompt_tokens":15,"total_tokens":74}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":"ural"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":60,"prompt_tokens":15,"total_tokens":75}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" Networks"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":61,"prompt_tokens":15,"total_tokens":76}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":"**:"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":62,"prompt_tokens":15,"total_tokens":77}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" Deep"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":63,"prompt_tokens":15,"total_tokens":78}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" learning"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":64,"prompt_tokens":15,"total_tokens":79}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" models"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":65,"prompt_tokens":15,"total_tokens":80}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" are"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":66,"prompt_tokens":15,"total_tokens":81}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" based"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":67,"prompt_tokens":15,"total_tokens":82}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" on"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":68,"prompt_tokens":15,"total_tokens":83}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" neural"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":69,"prompt_tokens":15,"total_tokens":84}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" networks"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":70,"prompt_tokens":15,"total_tokens":85}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":","},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":71,"prompt_tokens":15,"total_tokens":86}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" which"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":72,"prompt_tokens":15,"total_tokens":87}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" consist"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":73,"prompt_tokens":15,"total_tokens":88}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" of"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":74,"prompt_tokens":15,"total_tokens":89}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" layers"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":75,"prompt_tokens":15,"total_tokens":90}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" of"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":76,"prompt_tokens":15,"total_tokens":91}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" interconnected"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":77,"prompt_tokens":15,"total_tokens":92}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" nodes"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":78,"prompt_tokens":15,"total_tokens":93}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" ("},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":79,"prompt_tokens":15,"total_tokens":94}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":"or"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":80,"prompt_tokens":15,"total_tokens":95}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" neurons"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":81,"prompt_tokens":15,"total_tokens":96}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":")."},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":82,"prompt_tokens":15,"total_tokens":97}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" Each"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":83,"prompt_tokens":15,"total_tokens":98}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" connection"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":84,"prompt_tokens":15,"total_tokens":99}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" has"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":85,"prompt_tokens":15,"total_tokens":100}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" a"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":86,"prompt_tokens":15,"total_tokens":101}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" weight"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":87,"prompt_tokens":15,"total_tokens":102}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":","},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":88,"prompt_tokens":15,"total_tokens":103}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" and"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":89,"prompt_tokens":15,"total_tokens":104}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" the"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":90,"prompt_tokens":15,"total_tokens":105}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" network"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":91,"prompt_tokens":15,"total_tokens":106}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" learns"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":92,"prompt_tokens":15,"total_tokens":107}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" by"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":93,"prompt_tokens":15,"total_tokens":108}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" adjusting"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":94,"prompt_tokens":15,"total_tokens":109}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" these"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":95,"prompt_tokens":15,"total_tokens":110}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" weights"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":96,"prompt_tokens":15,"total_tokens":111}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" to"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":97,"prompt_tokens":15,"total_tokens":112}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" minimize"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":98,"prompt_tokens":15,"total_tokens":113}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" the"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":99,"prompt_tokens":15,"total_tokens":114}}

event: message
data: {"id":"chatcmpl-c06cb667-c627-4f69-bd49-089fc9886b86","choices":[{"delta":{"content":" error"},"finish_reason":"length","index":0}],"model":null,"object":null,"usage":{"completion_tokens":100,"prompt_tokens":15,"total_tokens":115}}

event: message
data: [DONE]


Perform Complex Chat Completion
URL: /_inference/chat_completion/google-model-garden-ai21-chat-completion-1/_stream?timeout=5m
Method: POST
Status Code: 200 OK
RQ:
{
    "messages": [
        {
            "role": "user",
            "content": "What's the price of a scarf?"
        }
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "get_current_price",
                "description": "Get the current price of a item",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "item": {
                            "id": "123"
                        }
                    }
                }
            }
        }
    ],
    "tool_choice": {
        "type": "function",
        "function": {
            "name": "get_current_price"
        }
    }
}
RS:
event: message
data: {"id":"chatcmpl-f80646d4-d35e-4396-a7f6-d333940ceb14","choices":[{"delta":{"content":"","role":"assistant"},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":0,"prompt_tokens":115,"total_tokens":115}}

event: message
data: {"id":"chatcmpl-f80646d4-d35e-4396-a7f6-d333940ceb14","choices":[{"delta":{"content":" "},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":1,"prompt_tokens":115,"total_tokens":116}}

event: message
data: {"id":"chatcmpl-f80646d4-d35e-4396-a7f6-d333940ceb14","choices":[{"delta":{"tool_calls":[{"index":0,"id":"chatcmpl-tool-744a656f4d674fff9f9f6eb2a482f0ff","function":{"name":"get_current_price"},"type":"function"}]},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":15,"prompt_tokens":115,"total_tokens":130}}

event: message
data: {"id":"chatcmpl-f80646d4-d35e-4396-a7f6-d333940ceb14","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\"item\": \""},"type":null}]},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":23,"prompt_tokens":115,"total_tokens":138}}

event: message
data: {"id":"chatcmpl-f80646d4-d35e-4396-a7f6-d333940ceb14","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"scar"},"type":null}]},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":24,"prompt_tokens":115,"total_tokens":139}}

event: message
data: {"id":"chatcmpl-f80646d4-d35e-4396-a7f6-d333940ceb14","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"f"},"type":null}]},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":25,"prompt_tokens":115,"total_tokens":140}}

event: message
data: {"id":"chatcmpl-f80646d4-d35e-4396-a7f6-d333940ceb14","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":""},"type":null}]},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":26,"prompt_tokens":115,"total_tokens":141}}

event: message
data: {"id":"chatcmpl-f80646d4-d35e-4396-a7f6-d333940ceb14","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":""},"type":null}]},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":27,"prompt_tokens":115,"total_tokens":142}}

event: message
data: {"id":"chatcmpl-f80646d4-d35e-4396-a7f6-d333940ceb14","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":""},"type":null}]},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":28,"prompt_tokens":115,"total_tokens":143}}

event: message
data: {"id":"chatcmpl-f80646d4-d35e-4396-a7f6-d333940ceb14","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":""},"type":null}]},"index":0}],"model":null,"object":null,"usage":{"completion_tokens":29,"prompt_tokens":115,"total_tokens":144}}

event: message
data: {"id":"chatcmpl-f80646d4-d35e-4396-a7f6-d333940ceb14","choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"},"type":null}]},"finish_reason":"tool_calls","index":0}],"model":null,"object":null,"usage":{"completion_tokens":30,"prompt_tokens":115,"total_tokens":145}}

event: message
data: [DONE]


@Jan-Kazlouski-elastic
Copy link
Contributor Author

Jan-Kazlouski-elastic commented Oct 2, 2025

Testing of the providers is finished. Other configurations such as:

  • Meta Dedicated Endpoint Function call (500 Error Code Server Errors on Model side)
  • Meta Shared Endpoint (getting constant timeouts)
  • Mistral Shared Endpoint (getting errors saying chat completion is not supported)
  • Ai21 Dedicated Endpoint (getting errors saying chat completion is not supported)

cannot be performed because endpoints do not return successful results.

@Jan-Kazlouski-elastic
Copy link
Contributor Author

@jonathan-buttner @DonalEvans @dan-rubinstein
Would you please take a look at this PR?

@gbanasiak gbanasiak added the :ml Machine learning label Oct 3, 2025
@elasticsearchmachine elasticsearchmachine added Team:ML Meta label for the ML team and removed needs:triage Requires assignment of a team area label labels Oct 3, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)


/**
* Creates a {@link org.elasticsearch.xcontent.ToXContent.Params} that causes ToXContent to include the key values:
* - Key: {@link #MAX_TOKENS_FIELD}, Value: {@link #MAX_TOKENS_FIELD}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be Value: {@link #maxCompletionTokens()}. The existing Javadoc on line 113 in this file has a similar mistake.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment on lines 42 to 48
if (modelId != null) {
// Standard Hugging Face models require a model ID
unifiedRequestEntity.toXContent(builder, UnifiedCompletionRequest.withMaxTokens(modelId, params));
} else {
// Some Hugging Face endpoints may not require a model ID
unifiedRequestEntity.toXContent(builder, UnifiedCompletionRequest.withMaxTokens(params));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to move the null check into the withMaxTokens(String modelId, Params params) method instead of having two different methods and requiring the caller know which one should be called?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree, let's have withMaxTokens(@Nullable String modelId, Params params) and do the null check there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 36 to 42
if (modelId != null) {
// Some Mistral endpoints require the model ID to be specified in the request body
unifiedRequestEntity.toXContent(builder, UnifiedCompletionRequest.withMaxTokensAndSkipStreamOptionsField(modelId, params));
} else {
// Some Mistral endpoints do not require the model ID to be specified
unifiedRequestEntity.toXContent(builder, UnifiedCompletionRequest.withMaxTokensAndSkipStreamOptionsField(params));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another place where we could move the null check into the method on UnifiedCompletionRequest instead of creating an extra method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 148 to 154
testExecute_ThrowsElasticsearchException(
null,
null,
null,
GoogleModelGardenProvider.META,
new URI("http://localhost:9200"),
GOOGLE_MODEL_GARDEN_META_COMPLETION_HANDLER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests in this class could be simplified a fair bit by removing the irrelevant parameters from the createAction() method signature. projectId, location, modelId and uri can all be null in every test without affecting the behaviour of the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Removed irrelevant params.

GoogleModelGardenProvider googleModelGardenProvider,
GoogleModelGardenProvider provider,
URI uri,
ResponseHandler googleModelGardenAnthropicCompletionHandler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name is a bit misleading, since in most of the tests, it's not specifically an Anthropic handler that's being passed in. This comment also applies to the similarly named parameter in testExecute_ThrowsElasticsearchException_WhenSenderOnFailureIsCalled().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed that. Renamed.

Copy link
Contributor

@jonathan-buttner jonathan-buttner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, left a suggestion.


private GenericRequestManager<ChatCompletionInput> createRequestManager(GoogleVertexAiChatCompletionModel model) {
switch (model.getServiceSettings().provider()) {
case GOOGLE -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we try to reduce these switch statements to a map. I'm thinking we could create a Provider class or something that has a static map of provider enums to an internal class that contains functions to constructor the 3 different things that we need these switch cases for.

Ideally we wouldn't need to pass an instance of the Provider class around. If possible we could do something like Provider.createCompletionRequestManager(provider, model)

That would grab the internal class and then call `createRequestManagerWithHandler(model, handler) with the static handler that is appropriate for that provider.

Provider would have a function for each of the switch states that we need.

Copy link
Contributor Author

@Jan-Kazlouski-elastic Jan-Kazlouski-elastic Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I had Ideas of moving this logic somewhere but initially decided not to.
Now I came up with an idea of moving the logic of getting response handlers and creating request entities to enum itself.
Of course I'm not a big fan of moving too much logic to enums, but having Provider class when we already have GoogleModelGardenProvider enum alongside is not ideal too IMHO. And that way when new provider is added - we can ideally localize the changes to a single file. To me - looks good. Please let me know what you think of it @jonathan-buttner

…x unit tests, change remove optional stream_options field from llama requests
@Jan-Kazlouski-elastic
Copy link
Contributor Author

@DonalEvans @jonathan-buttner
Your comments are addressed. Could you please give PR another look?

);

private static final ResponseHandler AI21_CHAT_COMPLETION_HANDLER = new Ai21ChatCompletionResponseHandler(
"Google Model Garden Ai21 chat completions",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpick, only fix this if there are other changes required, but this should be AI21, with an uppercase i

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this should be AI21, with an uppercase i
Good catch. Confused it with Ai2 which has Ai with lowercase i. Fixed now.

URI uri,
ResponseHandler handler
) {
private ExecutableAction createAction(Sender sender, GoogleModelGardenProvider provider, URI uri, ResponseHandler handler) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The uri method parameter is also irrelevant and can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, missed that. Removed now.

Copy link
Contributor

@jonathan-buttner jonathan-buttner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, one clarification for the switch statements.

* @return the ResponseHandler associated with the provider
*/
public ResponseHandler getCompletionResponseHandler() {
return switch (this) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the switches. I think we can do this by having a package private constructor. Something like:

@FunctionalInterface
private interface RequestEntityCreator {
  ToXContentObject create(UnifiedChatInput unifiedChatInput,
        String modelId,
        GoogleVertexAiChatCompletionTaskSettings taskSettings);
}

private final ResponseHandler completionResponseHandler;
private final ResponseHandler chatCompletionResponseHandler;
private final RequestEntityCreator entityCreator;

public enum GoogleModelGardenProvider {
    GOOGLE(GOOGLE_VERTEX_AI_COMPLETION_HANDLER, GOOGLE_VERTEX_AI_CHAT_COMPLETION_HANDLER, (unifiedInput, modelId, taskSettings) -> new GoogleVertexAiUnifiedChatCompletionRequestEntity(unifiedChatInput, taskSettings.thinkingConfig()),
...
}

GoogleModelGardenProvider(ResponseHandler a, ResponseHandler b, RequestEntityCreator entityCreator) { ... }

Then the methods in here just return/call the appropriate methods and we won't need the switches anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Had to move handlers into nested classes because you're not allowed read the value of a field before its definition and you cannot declare any fields before actual enum constants.

@Jan-Kazlouski-elastic
Copy link
Contributor Author

@jonathan-buttner
Your comment is addressed. There are no more switches.

Copy link
Contributor

@jonathan-buttner jonathan-buttner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

@Jan-Kazlouski-elastic
Copy link
Contributor Author

@jonathan-buttner Thanks for the approval! You can merge it when you are ready!

@jonathan-buttner
Copy link
Contributor

@elasticmachine merge upstream

@elasticmachine
Copy link
Collaborator

There are no new commits on the base branch.

@jonathan-buttner jonathan-buttner enabled auto-merge (squash) October 9, 2025 20:56
auto-merge was automatically disabled October 9, 2025 22:09

Head branch was pushed to by a user without write access

@Jan-Kazlouski-elastic
Copy link
Contributor Author

@jonathan-buttner
Found and fixed one little typo fix that was causing single unit test to fail from time to time. Because of my pushed commit - auto merge is disabled. If you could re-enable it - that would be great. Thanks!

@jonathan-buttner jonathan-buttner merged commit d4cb9ff into elastic:main Oct 10, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement external-contributor Pull request authored by a developer outside the Elasticsearch team :ml Machine learning Team:ML Meta label for the ML team v9.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants