Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to merge Darren's branch #32081

Draft
wants to merge 24 commits into
base: glharper-java-inference
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2bc4a5f
Go back to `parameters?: unknown` in FunctionDefinition model
dargilco Aug 19, 2024
4a29832
Merge remote-tracking branch 'origin/main' into dargilco/ai-model-inf…
dargilco Aug 19, 2024
d68a383
Add missing CompletionsFinishReason comments. Update tool choice rela…
dargilco Aug 19, 2024
adeddf3
Update JSON examples. Fix client.tsp after previous commit to rename …
dargilco Aug 19, 2024
3e95e57
Add ID back to EmbeddingsResult model. Add comment to getModelInfo th…
dargilco Aug 23, 2024
dedab7a
Update comments about hand-written operator methods
dargilco Aug 29, 2024
7507aaf
Update teh ModelInfo enum
dargilco Sep 12, 2024
e71bdd9
Merge branch 'main' into dargilco/ai-model-inference
trangevi Dec 10, 2024
6a1a4bc
Merge remote-tracking branch 'origin/main' into dargilco/ai-model-inf…
dargilco Dec 23, 2024
3e647af
Rename EmbeddingInput to ImageEmbeddingInput (#31953)
dargilco Dec 24, 2024
76224a0
Add Structured Outputs (#31962)
trangevi Dec 26, 2024
84764b1
Naming consistency (#31966)
trangevi Dec 27, 2024
55390d1
Merge remote-tracking branch 'origin/main' into dargilco/ai-model-inf…
dargilco Dec 27, 2024
53f0524
Fixes following `npx tsp format **\*.tsp`
dargilco Dec 27, 2024
f1954ee
Fix a couple of errors from `npx tsv .`
dargilco Dec 27, 2024
ee954ff
Add missing class description. Add updated swagger file
dargilco Dec 27, 2024
be57da7
Update description
dargilco Dec 27, 2024
a2bc8a2
Remove the in-line definition
dargilco Dec 27, 2024
e194ad7
Merge remote-tracking branch 'origin/main' into dargilco/ai-model-inf…
dargilco Jan 3, 2025
3409632
Make all response format models internal (#32005)
dargilco Jan 9, 2025
daf385d
Merge branch 'dargilco/ai-model-inference' into trangevi/structured-o…
trangevi Jan 10, 2025
3d1d279
Update client.tsp
glharper Jan 22, 2025
ce820ef
Update routes.tsp - workaround for https://github.com/Azure/typespec-…
glharper Jan 23, 2025
feb51b6
Update routes.tsp
glharper Jan 23, 2025
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
56 changes: 29 additions & 27 deletions specification/ai/ModelClient/client.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,23 @@ namespace Customizations; // The actual name here doesn't matter and is here for
@@usage(AI.Model.StreamingChatResponseMessageUpdate, Usage.output);
@@usage(AI.Model.StreamingChatResponseToolCallUpdate, Usage.output);

// Since we made all operator methods internal, we need to expliclty
// say we still want the models they use to be public.
// The operators need to be hidden, since we hand-write the public versions of those
@@access(AI.Model.getChatCompletions, Access.internal);
@@access(AI.Model.getEmbeddings, Access.internal);
@@access(AI.Model.getImageEmbeddings, Access.internal);
@@access(AI.Model.getModelInfo, Access.internal, "python");

// Since we made all operator methods internal, we need to explicity
// say we still want the models they use to be public, since they will be used by hand-written operator methods.
@@access(AI.Model.ChatChoice, Access.public);
@@access(AI.Model.ChatCompletions, Access.public);
@@access(AI.Model.ChatCompletionsToolCall, Access.public);
@@access(AI.Model.ChatCompletionsToolDefinition, Access.public);
@@access(AI.Model.ChatCompletionsNamedToolSelection, Access.public);
@@access(AI.Model.ChatCompletionsFunctionToolSelection, Access.public);
@@access(AI.Model.ChatCompletionsResponseFormat, Access.public);
@@access(AI.Model.ChatCompletionsResponseFormatJSON, Access.public);
@@access(AI.Model.ChatCompletionsResponseFormatText, Access.public);
@@access(AI.Model.ChatCompletionsNamedToolChoice, Access.public);
@@access(AI.Model.ChatCompletionsNamedToolChoiceFunction, Access.public);
@@access(AI.Model.ChatCompletionsToolCall, Access.public);
@@access(AI.Model.ChatCompletionsToolDefinition, Access.public);
@@access(AI.Model.ChatCompletionsToolSelectionPreset, Access.public);
@@access(AI.Model.ChatCompletionsToolChoicePreset, Access.public);
@@access(AI.Model.ChatRequestAssistantMessage, Access.public);
@@access(AI.Model.ChatRequestMessage, Access.public);
@@access(AI.Model.ChatRequestSystemMessage, Access.public);
Expand All @@ -39,12 +42,12 @@ namespace Customizations; // The actual name here doesn't matter and is here for
@@access(AI.Model.ChatRole, Access.public);
@@access(AI.Model.CompletionsFinishReason, Access.public);
@@access(AI.Model.CompletionsUsage, Access.public);
@@access(AI.Model.EmbeddingEncodingFormat, Access.public);
@@access(AI.Model.EmbeddingInput, Access.public);
@@access(AI.Model.EmbeddingInputType, Access.public);
@@access(AI.Model.EmbeddingItem, Access.public);
@@access(AI.Model.EmbeddingsResult, Access.public);
@@access(AI.Model.EmbeddingsUsage, Access.public);
@@access(AI.Model.EmbeddingEncodingFormat, Access.public, "python");
@@access(AI.Model.ImageEmbeddingInput, Access.public, "python");
@@access(AI.Model.EmbeddingInputType, Access.public, "python");
@@access(AI.Model.EmbeddingItem, Access.public, "python");
@@access(AI.Model.EmbeddingsResult, Access.public, "python");
@@access(AI.Model.EmbeddingsUsage, Access.public, "python");
@@access(AI.Model.ExtraParameters, Access.public, "java");
@@access(AI.Model.FunctionCall, Access.public);
@@access(AI.Model.FunctionDefinition, Access.public);
Expand All @@ -55,20 +58,19 @@ namespace Customizations; // The actual name here doesn't matter and is here for
@@access(AI.Model.ChatMessageImageContentItem, Access.public);
@@access(AI.Model.ChatMessageImageUrl, Access.public);
@@access(AI.Model.ChatMessageImageDetailLevel, Access.public);
@@access(AI.Model.StreamingChatCompletionsUpdate, Access.public);
@@access(AI.Model.StreamingChatChoiceUpdate, Access.public);
@@access(AI.Model.StreamingChatResponseMessageUpdate, Access.public);
@@access(AI.Model.StreamingChatResponseToolCallUpdate, Access.public);
@@access(AI.Model.StreamingChatCompletionsUpdate, Access.public, "python");
@@access(AI.Model.StreamingChatChoiceUpdate, Access.public, "python");
@@access(AI.Model.StreamingChatResponseMessageUpdate, Access.public, "python");
@@access(AI.Model.StreamingChatResponseToolCallUpdate, Access.public, "python");
@@access(AI.Model.ChatCompletionsResponseFormatJsonSchemaDefinition,
Access.public,
"python"
);

// The operators need to be hidden, since we hand-write the public versions of those to
// 1. Add chat completions streaming (to getChatCompletions operator)
// 2. Add hyper-params (to getChatCompletions/Embeddings/ImageEmbeddings, all clients)
// 3. Cache model info (to getModelInfo, all clients, Python only)
@@access(AI.Model.getChatCompletions, Access.internal);
@@access(AI.Model.getEmbeddings, Access.internal);
@@access(AI.Model.getImageEmbeddings, Access.internal);
@@access(AI.Model.getModelInfo, Access.internal);
@@clientName(AI.Model.ChatCompletionsResponseFormatJSON, "ChatCompletionsResponseFormatJson", "java");
@@clientName(AI.Model.ChatCompletionsResponseFormatJsonSchemaDefinition,
"JsonSchemaFormat",
"python"
);

// We use shorter names in the Python client library
@@clientName(AI.Model.ChatRequestSystemMessage, "SystemMessage", "python");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,57 +10,56 @@
"role": "ChatRequestMessage"
}
],
"frequency_penalty": 1,
"frequency_penalty": -2,
"stream": true,
"presence_penalty": -2,
"presence_penalty": -1,
"temperature": 0,
"top_p": 0,
"max_tokens": 0,
"response_format": {
"type": "ChatCompletionsResponseFormat"
},
"stop": [
"lwlqenszpaurxntgit"
"dcfnxrdeumnoytdaooqkbl"
],
"tools": [
{
"type": "function",
"function": {
"name": "velupowkmhiyypklqmgzzlmcjokcs",
"description": "dngfctkfjoypnjfikiowvpuvisga",
"parameters": {}
"name": "ikvkykzp",
"description": "gofxoftbpdi"
}
}
],
"seed": 10,
"model": "bcxpoxjhymqvjo"
"seed": 21,
"model": "askiizcjob"
}
},
"responses": {
"200": {
"body": {
"id": "qdjwxvfotmorpdevwdmhbqnsgi",
"created": 16,
"model": "wr",
"id": "kgousajxgzyhugvqekuswuqbk",
"created": 18,
"model": "zjxvtpxhzhvgjrhit",
"usage": {
"completion_tokens": 9,
"prompt_tokens": 15,
"total_tokens": 1
"completion_tokens": 19,
"prompt_tokens": 28,
"total_tokens": 16
},
"choices": [
{
"index": 29,
"index": 7,
"finish_reason": "stop",
"message": {
"role": "system",
"content": "wynvtftvlenfzzzrfmg",
"content": "jnsnrwblpuokzbkrzdcwubpfz",
"tool_calls": [
{
"id": "zlmfpvg",
"id": "yrobmilsrugmbwukmzo",
"type": "function",
"function": {
"name": "velupowkmhiyypklqmgzzlmcjokcs",
"arguments": "zocluceldmcazefk"
"name": "ikvkykzp",
"arguments": "oqxvktuduomvckic"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
"responses": {
"200": {
"body": {
"id": "qdjwxvfotmorpdevwdmhbqnsgi",
"created": 16,
"model": "wr",
"id": "kgousajxgzyhugvqekuswuqbk",
"created": 18,
"model": "zjxvtpxhzhvgjrhit",
"usage": {
"completion_tokens": 9,
"prompt_tokens": 15,
"total_tokens": 1
"completion_tokens": 19,
"prompt_tokens": 28,
"total_tokens": 16
},
"choices": [
{
"index": 29,
"index": 7,
"finish_reason": "stop",
"message": {
"role": "system",
"content": "wynvtftvlenfzzzrfmg"
"content": "jnsnrwblpuokzbkrzdcwubpfz"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,28 @@
"extra-parameters": "error",
"body": {
"input": [
"wditkfkcn"
"p"
],
"dimensions": 14,
"dimensions": 11,
"encoding_format": "base64",
"input_type": "text",
"model": "esgcnvlwfzgrstu"
"model": "kwkpluujwiabfquhkaugttxut"
}
},
"responses": {
"200": {
"body": {
"id": "cknxthfa",
"data": [
{
"index": 4
"index": 21
}
],
"usage": {
"prompt_tokens": 30,
"total_tokens": 29
"prompt_tokens": 4,
"total_tokens": 22
},
"model": "rbnjxkkdrp"
"model": "uvrmctbnze"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,30 @@
"body": {
"input": [
{
"image": "hxkwvrx",
"text": "qpoyljvucirvkzjhhnhpdeqkl"
"image": "puqkvvlvgcjyzughesnkena",
"text": "azrzyjsmnuefqpowpvfmyobeehqsni"
}
],
"dimensions": 17,
"dimensions": 26,
"encoding_format": "base64",
"input_type": "text",
"model": "wssoguntnhwg"
"model": "jyb"
}
},
"responses": {
"200": {
"body": {
"id": "cknxthfa",
"data": [
{
"index": 4
"index": 21
}
],
"usage": {
"prompt_tokens": 30,
"total_tokens": 29
"prompt_tokens": 4,
"total_tokens": 22
},
"model": "rbnjxkkdrp"
"model": "uvrmctbnze"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"responses": {
"200": {
"body": {
"model_name": "wzkm",
"model_name": "jno",
"model_type": "embeddings",
"model_provider_name": "jkxwuyloxsmuhsevvytzp"
"model_provider_name": "ulyaphtaszwdkefpbkklnjtrhzh"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"responses": {
"200": {
"body": {
"model_name": "wzkm",
"model_name": "jno",
"model_type": "embeddings",
"model_provider_name": "jkxwuyloxsmuhsevvytzp"
"model_provider_name": "ulyaphtaszwdkefpbkklnjtrhzh"
}
}
}
Expand Down
Loading
Loading