Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
d0fcdff
Update changelog (#35929)
xiangyan99 Jun 5, 2024
8c581a2
Autoinstrumentation rework (#35890)
jeremydvoss Jun 5, 2024
72919a9
switch to majority entra auth for tests (#35581)
kristapratico Jun 6, 2024
428ccf2
add a new parameter allow_roleassignment_on_rg to allow/disallow role…
wenjie1070116 Jun 6, 2024
61138a7
Increment package version after release of azure-core (#35950)
azure-sdk Jun 6, 2024
e6f98bc
[Event Hubs] Update URI used for consumer auth to include consumer gr…
swathipil Jun 6, 2024
697a9bf
Allow configuration of metric Views in distro (#35932)
lzchen Jun 6, 2024
bf4ee7f
[EventHub] Update README for enable logging section (#35955)
swathipil Jun 6, 2024
215bb40
[Storage] [STG 94] Merge STG 94 into `main` branch (#35888)
weirongw23-msft Jun 6, 2024
6e6648a
Sync eng/common directory with azure-sdk-tools for PR 8377 (#35915)
azure-sdk Jun 6, 2024
a73ca09
Distro release 1.6.0 (#35935)
jeremydvoss Jun 6, 2024
ae48eea
Python client for Model-as-a-Service (MaaS) / Model-as-a-Platform (Ma…
dargilco Jun 7, 2024
610da5d
[AutoRelease] t2-datafactory-2024-06-03-75602(can only be merged by S…
azure-sdk Jun 7, 2024
5b30781
Use DOTNET_ROLL_FORWARD: 'Major' for test-proxy (#35956)
azure-sdk Jun 7, 2024
acd606f
Pin pester version to 5.5.0 (#35967)
azure-sdk Jun 7, 2024
6bb9e47
Some minor updates to package & samples README.md files (#35971)
dargilco Jun 7, 2024
0b99ee1
add aoai assistants streaming/v2 tests (#35443)
kristapratico Jun 7, 2024
9b98575
[Identity] Allow use of client assertion in OBO cred (#35812)
pvaneck Jun 7, 2024
984542f
[Identity] Disable live service principal tests (#35958)
pvaneck Jun 7, 2024
a7cb46a
set storage account access to identity-based for feature store creati…
runhli Jun 7, 2024
9b6427c
Change Workspace related PR reviewer (#35921)
debuggerXi Jun 10, 2024
8abbc26
[EG] GA Namespaces (#35831)
l0lawrence Jun 10, 2024
f24b567
Increment package version after release of azure-monitor-opentelemetr…
azure-sdk Jun 10, 2024
c9b1e27
update test for new structure of custom blocklist (#36001)
kristapratico Jun 10, 2024
ec8190c
Update github-event-processor to 1.0.0-dev.20240610.2 (#36000)
azure-sdk Jun 10, 2024
81de947
[Identity] Minor doc updates (#35974)
pvaneck Jun 10, 2024
2ac0060
allow for futher embedded snippets (#36004)
l0lawrence Jun 10, 2024
40cf085
[Monitor Query + Ingestions] Update changelogs (#35942)
pvaneck Jun 10, 2024
cb065ac
[Identity] Managed identity bug fix (#36010)
pvaneck Jun 10, 2024
fe0e014
Added release dates (#36006)
vincenttran-msft Jun 10, 2024
5b55203
Remove MayankKumar91 (#35911)
lmazuel Jun 10, 2024
adbac73
Increment package version after release of azure-identity (#36015)
azure-sdk Jun 10, 2024
10c3c79
Always run analyze weekly (#35968)
kristapratico Jun 11, 2024
433b99a
move samples (#35966)
l0lawrence Jun 11, 2024
4356326
[Key Vault] Change location for weekly China cloud tests (#36018)
mccoyp Jun 11, 2024
5fd14fe
Fix Sphinx on azure-storage-blob-changefeed (#35975)
Jun 11, 2024
dff6744
update release date (#36028)
l0lawrence Jun 11, 2024
b052da8
azure-mgmt-core shouldn't use mgmt docs build (#35936)
kristapratico Jun 11, 2024
d97ff44
Identity credential unavailable error non json imds (#36016)
xiangyan99 Jun 11, 2024
e08b3b0
Update azure-ai-inference client library to support sending images as…
dargilco Jun 11, 2024
cf49b4e
Export InputTypes from constants (#35848)
emepetres Jun 11, 2024
a79c5ab
[EG] Eventgrid Release (#36030)
l0lawrence Jun 11, 2024
47fdf5d
Fix Sphinx on azure-storage-blob (#36014)
Jun 11, 2024
1552259
[Identity] Update AzurePipelinesCredential (#35858)
pvaneck Jun 11, 2024
01fa69c
upgrade autorest.python to `6.13.19` (#36024)
msyyc Jun 12, 2024
215eb63
Increment version for monitor releases (#36036)
azure-sdk Jun 12, 2024
bfd541b
compatible with new date format (#36049)
msyyc Jun 12, 2024
5b61bd4
[AutoRelease] t2-cdn-2024-06-12-45722(can only be merged by SDK owner…
azure-sdk Jun 12, 2024
614a928
[EG] link + patch update (#36045)
l0lawrence Jun 12, 2024
80ecdfb
async with (#36060)
l0lawrence Jun 12, 2024
2aba54e
Incremental (#36040)
vincenttran-msft Jun 12, 2024
379cfd3
typo (#36062)
l0lawrence Jun 12, 2024
c5e1659
Fix prepare-pipelines line wrapping (#36061)
azure-sdk Jun 12, 2024
fda24bd
[bct] Initial refactoring breaking changes tool (#36005)
catalinaperalta Jun 12, 2024
a642e74
Update swagger_to_sdk_config_dpg.json (#36068)
msyyc Jun 13, 2024
3ce8196
Increment package version after release of azure-eventgrid (#36063)
azure-sdk Jun 13, 2024
66d5de4
Sync eng/common directory with azure-sdk-tools for PR 8388 (#35970)
azure-sdk Jun 13, 2024
15bcb99
report number of breaking changes (#36067)
catalinaperalta Jun 13, 2024
0f27374
update codeowner (#36074)
xiangyan99 Jun 13, 2024
d7bfdb0
update strict-sphinx to v7 (#36075)
kristapratico Jun 13, 2024
df9c8c7
Update spelling dependencies (#36084)
azure-sdk Jun 14, 2024
3e7dff6
[DevCenter] Update release date (#36083)
drielenr Jun 14, 2024
147746b
[Identity] Add TSG section for AzurePipelinesCredential (#36048)
pvaneck Jun 14, 2024
c19f701
Support sending image data as part of a user message, using a new Ima…
dargilco Jun 14, 2024
ee65563
update (#36051)
msyyc Jun 14, 2024
892881a
Increment package version after release of azure-ai-inference (#36091)
azure-sdk Jun 14, 2024
c6383aa
address API review comments (#36058)
Adarsh-Ramanathan Jun 14, 2024
811dc0e
Update CodeownersLinter version to 1.0.0-dev.20240614.4 (#36093)
azure-sdk Jun 14, 2024
fe435b7
[AutoRelease] t2-mobilenetwork-2024-06-05-65505(can only be merged by…
azure-sdk Jun 17, 2024
a566320
[AutoRelease] t2-storagemover-2024-06-11-87054(can only be merged by …
azure-sdk Jun 17, 2024
698cd95
code and test (#35959)
azure-sdk Jun 17, 2024
40a2625
[AutoRelease] t2-web-2024-06-07-57417(can only be merged by SDK owner…
azure-sdk Jun 17, 2024
3c833e1
Update breaking_changes_allowlist.py (#36104)
msyyc Jun 17, 2024
323fdc7
appconfig mi test (#35842)
xiangyan99 Jun 17, 2024
c51ac91
Bugfix: None was being appended to output path for batch-endpoint inv…
nagkumar91 Jun 17, 2024
cd1725e
Sync eng/common directory with azure-sdk-tools for PR 8457 (#36113)
azure-sdk Jun 17, 2024
d791bc6
Merge branch 'main' into 1.17.0-core-main-merge
MilesHolland Jun 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Support sending image data as part of a user message, using a new Ima…
…geUrl.load() method. Add sample and test. (#36042)
  • Loading branch information
dargilco authored Jun 14, 2024
commit c19f70199f49e6ac4bf54696f9a4e52bd897914a
9 changes: 7 additions & 2 deletions sdk/ai/azure-ai-inference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,13 @@ print(response.choices[0].message.content)

<!-- END SNIPPET -->

The following types or messages are supported: `SystemMessage`,`UserMessage`, `AssistantMessage`, `ToolMessage`. See sample [sample_chat_completions_with_tools.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_tools.py) for usage of `ToolMessage`. See [sample_chat_completions_with_images.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_images.py) for usage of `UserMessage` that
includes uploading an image.
The following types or messages are supported: `SystemMessage`,`UserMessage`, `AssistantMessage`, `ToolMessage`. See also samples:

* [sample_chat_completions_with_tools.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_tools.py) for usage of `ToolMessage`.
* [sample_chat_completions_with_image_url.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_image_url.py) for usage of `UserMessage` that
includes sending an image URL.
* [sample_chat_completions_with_image_data.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_image_data.py) for usage of `UserMessage` that
includes sending image data read from a local file.

Alternatively, you can provide the messages as dictionary instead of using the strongly typed classes like `SystemMessage` and `UserMessage`:

Expand Down
1 change: 1 addition & 0 deletions sdk/ai/azure-ai-inference/azure/ai/inference/_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
https://github.com/Azure/autorest.python/issues/2619 (all clients).
Otherwise intellisense did not show the patched public methods on the client object,
when the client is defined using context manager ("with" statement).
6. Add support for load() method in ImageUrl class (see /models/_patch.py).

"""
import json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ._models import ChatCompletionsToolDefinition
from ._models import ContentItem
from ._models import ImageContentItem
from ._models import ImageUrl
from ._patch import ImageUrl
from ._models import TextContentItem
from ._models import ChatRequestMessage
from ._models import ChatResponseMessage
Expand Down
47 changes: 44 additions & 3 deletions sdk/ai/azure-ai-inference/azure/ai/inference/models/_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,58 @@
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
import asyncio
import base64
import json
import logging
import queue
import re
import sys

from typing import List, AsyncIterator, Iterator
from typing import List, AsyncIterator, Iterator, Optional, Union
from azure.core.rest import HttpResponse, AsyncHttpResponse
from ._models import ImageUrl as ImageUrlGenerated
from .. import models as _models

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self

logger = logging.getLogger(__name__)


class ImageUrl(ImageUrlGenerated):

@classmethod
def load(
cls,
*,
image_file: str,
image_format: str,
detail: Optional[Union[str, "_models.ImageDetailLevel"]] = None
) -> Self:
"""
Create an ImageUrl object from a local image file. The method reads the image
file and encodes it as a base64 string, which together with the image format
is then used to format the JSON `url` value passed in the request payload.

:ivar image_file: The name of the local image file to load. Required.
:vartype image_file: str
:ivar image_format: The MIME type format of the image. For example: "jpeg", "png". Required.
:vartype image_format: str
:ivar detail: The evaluation quality setting to use, which controls relative prioritization of
speed, token consumption, and accuracy. Known values are: "auto", "low", and "high".
:vartype detail: str or ~azure.ai.inference.models.ImageDetailLevel
:return: An ImageUrl object with the image data encoded as a base64 string.
:rtype: ~azure.ai.inference.models.ImageUrl
:raises FileNotFoundError when the image file could not be opened.
"""
with open(image_file, "rb") as f:
image_data = base64.b64encode(f.read()).decode("utf-8")
url = f"data:image/{image_format};base64,{image_data}"
return cls(url=url, detail=detail)


class BaseStreamingChatCompletions:
"""A base class for the sync and async streaming chat completions responses, holding any common code
to deserializes the Server Sent Events (SSE) response stream into chat completions updates, each one
Expand Down Expand Up @@ -106,7 +146,7 @@ def __init__(self, response: HttpResponse):
def __iter__(self):
return self

def __next__(self) -> _models.StreamingChatCompletionsUpdate:
def __next__(self) -> "_models.StreamingChatCompletionsUpdate":
while self._queue.empty() and not self._done:
self._done = self._read_next_block()
if self._queue.empty():
Expand Down Expand Up @@ -145,7 +185,7 @@ def __init__(self, response: AsyncHttpResponse):
def __aiter__(self):
return self

async def __anext__(self) -> _models.StreamingChatCompletionsUpdate:
async def __anext__(self) -> "_models.StreamingChatCompletionsUpdate":
while self._queue.empty() and not self._done:
self._done = await self._read_next_block_async()
if self._queue.empty():
Expand All @@ -170,6 +210,7 @@ async def aclose(self) -> None:


__all__: List[str] = [
"ImageUrl",
"StreamingChatCompletions",
"AsyncStreamingChatCompletions",
] # Add all objects you want publicly available to users at this package level
Expand Down
5 changes: 3 additions & 2 deletions sdk/ai/azure-ai-inference/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,12 @@ similarly for the other samples.
|[sample_chat_completions_streaming.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_streaming.py) | One chat completion operation using a synchronous client and streaming response. |
|[sample_chat_completions_streaming_with_entra_id_auth.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_streaming_with_entra_id_auth.py) | One chat completion operation using a synchronous client and streaming response, using Entra ID authentication. This sample also shows setting the `azureml-model-deployment` HTTP request header, which may be required for some Managed Compute endpoint. |
|[sample_chat_completions.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions.py) | One chat completion operation using a synchronous client. |
|[sample_chat_completions_with_images.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_images.py) | One chat completion operation using a synchronous client, which includes sending an input image. |
|[sample_chat_completions_with_image_url.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_image_url.py) | One chat completion operation using a synchronous client, which includes sending an input image URL. |
|[sample_chat_completions_with_image_data.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_image_data.py) | One chat completion operation using a synchronous client, which includes sending input image data read from a local file. |
|[sample_chat_completions_with_history.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_history.py) | Two chat completion operations using a synchronous client, with the second completion using chat history from the first. |
|[sample_chat_completions_from_input_bytes.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_from_input_bytes.py) | One chat completion operation using a synchronous client, with input messages provided as `IO[bytes]`. |
|[sample_chat_completions_from_input_json.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_from_input_json.py) | One chat completion operation using a synchronous client, with input messages provided as a dictionary (type `MutableMapping[str, Any]`) |
|[sample_chat_completions_from_input_json_with_images.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_from_input_json_with_images.py) | One chat completion operation using a synchronous client, with input messages provided as a dictionary (type `MutableMapping[str, Any]`). Includes sending an input image. |
|[sample_chat_completions_from_input_json_with_image_url.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_from_input_json_with_image_url.py) | One chat completion operation using a synchronous client, with input messages provided as a dictionary (type `MutableMapping[str, Any]`). Includes sending an input image URL. |
|[sample_chat_completions_with_tools.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_tools.py) | Shows how do use a tool (function) in chat completions, for an AI model that supports tools |
|[sample_load_client.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_load_client.py) | Shows how do use the function `load_client` to create the appropriate synchronous client based on the provided endpoint URL. In this example, it creates a synchronous `ChatCompletionsClient`. |
|[sample_get_model_info.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_get_model_info.py) | Get AI model information using the chat completions client. Similarly can be done with all other clients. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
This sample demonstrates how to get a chat completions response from
the service using a synchronous client, and directly providing the
JSON request body (containing input chat messages). The sample
shows how to include an image in the input chat messages.
shows how to include an image URL in the input chat messages.
This sample will only work on AI models that support image input.

USAGE:
python sample_chat_completions_from_input_json_with_image.py
python sample_chat_completions_from_input_json_with_image_url.py

Set these two or three environment variables before running the sample:
1) CHAT_COMPLETIONS_ENDPOINT - Your endpoint URL, in the form
Expand All @@ -26,7 +26,7 @@
# pyright: reportAttributeAccessIssue=false


def sample_chat_completions_from_input_json_with_image():
def sample_chat_completions_from_input_json_with_image_url():
import os
from azure.ai.inference import ChatCompletionsClient
from azure.core.credentials import AzureKeyCredential
Expand Down Expand Up @@ -83,4 +83,4 @@ def sample_chat_completions_from_input_json_with_image():


if __name__ == "__main__":
sample_chat_completions_from_input_json_with_image()
sample_chat_completions_from_input_json_with_image_url()
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""
DESCRIPTION:
This sample demonstrates how to get a chat completions response from
the service using a synchronous client. The sample shows how to load
an image from a file and include it in the input chat messages.
This sample will only work on AI models that support image input.

USAGE:
python sample_chat_completions_with_image_data.py

Set these two or three environment variables before running the sample:
1) CHAT_COMPLETIONS_ENDPOINT - Your endpoint URL, in the form
https://<your-deployment-name>.<your-azure-region>.inference.ai.azure.com
where `your-deployment-name` is your unique AI Model deployment name, and
`your-azure-region` is the Azure region where your model is deployed.
2) CHAT_COMPLETIONS_KEY - Your model key (a 32-character string). Keep it secret.
3) CHAT_COMPLETIONS_DEPLOYMENT_NAME - Optional. The value for the HTTP
request header `azureml-model-deployment`.
"""


def sample_chat_completions_with_image_data():
import os
from azure.ai.inference import ChatCompletionsClient
from azure.ai.inference.models import (
SystemMessage, UserMessage, TextContentItem,
ImageContentItem, ImageUrl, ImageDetailLevel
)
from azure.core.credentials import AzureKeyCredential

try:
endpoint = os.environ["CHAT_COMPLETIONS_ENDPOINT"]
key = os.environ["CHAT_COMPLETIONS_KEY"]
except KeyError:
print("Missing environment variable 'CHAT_COMPLETIONS_ENDPOINT' or 'CHAT_COMPLETIONS_KEY'")
print("Set them before running this sample.")
exit()

try:
model_deployment = os.environ["CHAT_COMPLETIONS_DEPLOYMENT_NAME"]
except KeyError:
print("Could not read optional environment variable `CHAT_COMPLETIONS_DEPLOYMENT_NAME`.")
print("HTTP request header `azureml-model-deployment` will not be set.")
model_deployment = None

client = ChatCompletionsClient(
endpoint=endpoint,
credential=AzureKeyCredential(key),
headers={"azureml-model-deployment": model_deployment},
)

response = client.complete(
messages=[
SystemMessage(content="You are an AI assistant that describes images in details."),
UserMessage(
content=[
TextContentItem(text="What's in this image?"),
ImageContentItem(
image_url=ImageUrl.load(
image_file="sample1.png",
image_format="png",
detail=ImageDetailLevel.HIGH,
),
),
],
),
],
)

print(response.choices[0].message.content)


def get_image_data_url(image_file: str, image_format: str) -> str:
import base64
try:
with open(image_file, "rb") as f:
image_data = base64.b64encode(f.read()).decode("utf-8")
except FileNotFoundError:
print(f"Could not read '{image_file}'.")
print("Set the correct path to the image file before running this sample.")
exit()
return f"data:image/{image_format};base64,{image_data}"


if __name__ == "__main__":
sample_chat_completions_with_image_data()
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
DESCRIPTION:
This sample demonstrates how to get a chat completions response from
the service using a synchronous client. The sample
shows how to include an image in the input chat messages.
shows how to include an image URL in the input chat messages.
This sample will only work on AI models that support image input.

USAGE:
python sample_chat_completions_with_images.py
python sample_chat_completions_with_image_url.py

Set these two or three environment variables before running the sample:
1) CHAT_COMPLETIONS_ENDPOINT - Your endpoint URL, in the form
Expand All @@ -23,7 +23,7 @@
"""


def sample_chat_completions_with_images():
def sample_chat_completions_with_image_url():
import os
from azure.ai.inference import ChatCompletionsClient
from azure.ai.inference.models import (
Expand Down Expand Up @@ -74,4 +74,4 @@ def sample_chat_completions_with_images():


if __name__ == "__main__":
sample_chat_completions_with_images()
sample_chat_completions_with_image_url()
13 changes: 13 additions & 0 deletions sdk/ai/azure-ai-inference/tests/test_model_inference_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Licensed under the MIT License.
# ------------------------------------
import inspect
import os
import azure.ai.inference as sdk

from model_inference_test_base import ModelClientTestBase, ServicePreparerChatCompletions, ServicePreparerEmbeddings
Expand Down Expand Up @@ -65,6 +66,18 @@ def test_embeddings(self, **kwargs):
self._validate_embeddings_result(response)
client.close()

def test_image_url_load(self, **kwargs):
local_folder = os.path.dirname(os.path.abspath(__file__))
image_file = os.path.join(local_folder, "../samples/sample1.png")
image_url = sdk.models._patch.ImageUrl.load(
image_file=image_file,
image_format="png",
detail=sdk.models.ImageDetailLevel.AUTO,
)
assert image_url
assert image_url.url.startswith("data:image/png;base64,iVBORw")
assert image_url.detail == sdk.models.ImageDetailLevel.AUTO

# **********************************************************************************
#
# HAPPY PATH TESTS - CHAT COMPLETIONS
Expand Down