Skip to content

Commit

Permalink
limit scope of text and image embedding clients to Python only
Browse files Browse the repository at this point in the history
  • Loading branch information
dargilco committed Jun 10, 2024
1 parent 4478a53 commit 1e69395
Show file tree
Hide file tree
Showing 17 changed files with 122 additions and 123 deletions.
17 changes: 8 additions & 9 deletions specification/ai/ModelClient/client.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ using TypeSpec.Versioning;
@useDependency(ModelClient.Versions.v2024_05_01_Preview)
namespace Customizations; // The actual name here doesn't matter and is here for organization purposes only

// These models are used by the hand-written operator methods.
// We need to declare their usage and public access, otherwise they won't be emited in the generated code.
@@usage(ModelClient.StreamingChatChoiceUpdate, Usage.output);
// Are these needed?
@@usage(ModelClient.ChatCompletions, Usage.output);
@@usage(ModelClient.StreamingChatCompletionsUpdate, Usage.output);
@@usage(ModelClient.ModelInfo, Usage.output);
@@usage(ModelClient.StreamingChatChoiceUpdate, Usage.output);
@@usage(ModelClient.StreamingChatCompletionsUpdate, Usage.output);

// Since we made all operator methods internal, we need to expliclty say we still want the models they use
// to be public.
// Since we made all operator methods internal, we need to expliclty
// say we still want the models they use to be public.
@@access(ModelClient.ChatChoice, Access.public);
@@access(ModelClient.ChatCompletions, Access.public);
@@access(ModelClient.ChatCompletionsFunctionToolCall, Access.public);
Expand Down Expand Up @@ -57,7 +56,7 @@ namespace Customizations; // The actual name here doesn't matter and is here for
// 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)
// 3. Cache model info (to getModelInfo, all clients, Python only)
@@access(ModelClient.getChatCompletions, Access.internal, "python");
@@access(ModelClient.getEmbeddings, Access.internal, "python");
@@access(ModelClient.getImageEmbeddings, Access.internal, "python");
Expand All @@ -75,7 +74,7 @@ interface Client1 {
@client({
name: "EmbeddingsClient",
service: ModelClient,
})
}, "python")
interface Client2 {
embed is ModelClient.getEmbeddings;
getModelInfo is ModelClient.getModelInfo;
Expand All @@ -84,7 +83,7 @@ interface Client2 {
@client({
name: "ImageEmbeddingsClient",
service: ModelClient,
})
}, "python")
interface Client3 {
embed is ModelClient.getImageEmbeddings;
getModelInfo is ModelClient.getModelInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,46 @@
"role": "ChatRequestMessage"
}
],
"frequency_penalty": 1,
"frequency_penalty": -2,
"stream": true,
"presence_penalty": 0,
"temperature": 0,
"top_p": 0,
"max_tokens": 0,
"response_format": "text",
"stop": [
"ftfcfmwymaiaxq"
"jsgknsbxaqse"
],
"tools": [
{
"type": "ChatCompletionsToolDefinition"
}
],
"seed": 28
"seed": 16
}
},
"responses": {
"200": {
"body": {
"id": "lucg",
"created": 11,
"model": "tsqex",
"id": "vttvkvwbbvgjtqphyswtfjq",
"created": 12,
"model": "yyxicqgwvohxtfgwaymlypcyuyskgl",
"usage": {
"completion_tokens": 10,
"completion_tokens": 19,
"prompt_tokens": 14,
"total_tokens": 7
"total_tokens": 16
},
"choices": [
{
"index": 4,
"index": 1,
"finish_reason": "stop",
"message": {
"role": "system",
"content": "xtrirgreezabshxirfhi",
"content": "vjwamdxrsbqojpolqr",
"tool_calls": [
{
"type": "ChatCompletionsToolCall",
"id": "kicdohgtfw"
"id": "pmmdjgalvahbkafjqir"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
"responses": {
"200": {
"body": {
"id": "lucg",
"created": 11,
"model": "tsqex",
"id": "vttvkvwbbvgjtqphyswtfjq",
"created": 12,
"model": "yyxicqgwvohxtfgwaymlypcyuyskgl",
"usage": {
"completion_tokens": 10,
"completion_tokens": 19,
"prompt_tokens": 14,
"total_tokens": 7
"total_tokens": 16
},
"choices": [
{
"index": 4,
"index": 1,
"finish_reason": "stop",
"message": {
"role": "system",
"content": "xtrirgreezabshxirfhi"
"content": "vjwamdxrsbqojpolqr"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@
"unknown-parameters": "error",
"body": {
"input": [
"udxqxeltsnnnojgwpppb"
"uwfwjjkuc"
],
"dimensions": 1,
"dimensions": 20,
"encoding_format": "base64",
"input_type": "text"
}
},
"responses": {
"200": {
"body": {
"id": "fwajvrkzedj",
"id": "vjtifrodzwydvynddmbudnno",
"data": [
{
"embedding": [
3
16
],
"index": 15
"index": 1
}
],
"usage": {
"input_tokens": 4,
"prompt_tokens": 27,
"total_tokens": 14
"input_tokens": 20,
"prompt_tokens": 28,
"total_tokens": 2
},
"model": "rzfpwylkkwnqoerjogdqgf"
"model": "obwfxvadcvvziooogpswzqkn"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
"api-version": "2024-05-01-preview",
"body": {
"input": [
"abhxkxorcejjnfwidhhbf"
"ujqrjllpyke"
]
}
},
"responses": {
"200": {
"body": {
"id": "fwajvrkzedj",
"id": "vjtifrodzwydvynddmbudnno",
"data": [
{
"embedding": [
3
16
],
"index": 15
"index": 1
}
],
"usage": {
"input_tokens": 4,
"prompt_tokens": 27,
"total_tokens": 14
"input_tokens": 20,
"prompt_tokens": 28,
"total_tokens": 2
},
"model": "rzfpwylkkwnqoerjogdqgf"
"model": "obwfxvadcvvziooogpswzqkn"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@
"body": {
"input": [
{
"image": "jwbxrzdcafrxmhrztwepxmsrgys",
"text": "tmsxeneoqsimdpezbblrmvscvee"
"image": "rlwzmtmuitzvs",
"text": "htjxmfwdiw"
}
],
"dimensions": 16,
"dimensions": 26,
"encoding_format": "base64",
"input_type": "text"
}
},
"responses": {
"200": {
"body": {
"id": "fwajvrkzedj",
"id": "vjtifrodzwydvynddmbudnno",
"data": [
{
"embedding": [
3
16
],
"index": 15
"index": 1
}
],
"usage": {
"input_tokens": 4,
"prompt_tokens": 27,
"total_tokens": 14
"input_tokens": 20,
"prompt_tokens": 28,
"total_tokens": 2
},
"model": "rzfpwylkkwnqoerjogdqgf"
"model": "obwfxvadcvvziooogpswzqkn"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@
"body": {
"input": [
{
"image": "jwbxrzdcafrxmhrztwepxmsrgys"
"image": "rlwzmtmuitzvs"
}
]
}
},
"responses": {
"200": {
"body": {
"id": "fwajvrkzedj",
"id": "vjtifrodzwydvynddmbudnno",
"data": [
{
"embedding": [
3
16
],
"index": 15
"index": 1
}
],
"usage": {
"input_tokens": 4,
"prompt_tokens": 27,
"total_tokens": 14
"input_tokens": 20,
"prompt_tokens": 28,
"total_tokens": 2
},
"model": "rzfpwylkkwnqoerjogdqgf"
"model": "obwfxvadcvvziooogpswzqkn"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"responses": {
"200": {
"body": {
"model_name": "gqhcghuvgajmrjva",
"model_name": "uvbxltprmh",
"model_type": "embeddings",
"model_provider_name": "fqkylpirzwbklhcbgc"
"model_provider_name": "uuklhgbngggjryjphasqjiyk"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"responses": {
"200": {
"body": {
"model_name": "gqhcghuvgajmrjva",
"model_name": "uvbxltprmh",
"model_type": "embeddings",
"model_provider_name": "fqkylpirzwbklhcbgc"
"model_provider_name": "uuklhgbngggjryjphasqjiyk"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,46 @@
"role": "ChatRequestMessage"
}
],
"frequency_penalty": 1,
"frequency_penalty": -2,
"stream": true,
"presence_penalty": 0,
"temperature": 0,
"top_p": 0,
"max_tokens": 0,
"response_format": "text",
"stop": [
"ftfcfmwymaiaxq"
"jsgknsbxaqse"
],
"tools": [
{
"type": "ChatCompletionsToolDefinition"
}
],
"seed": 28
"seed": 16
}
},
"responses": {
"200": {
"body": {
"id": "lucg",
"created": 11,
"model": "tsqex",
"id": "vttvkvwbbvgjtqphyswtfjq",
"created": 12,
"model": "yyxicqgwvohxtfgwaymlypcyuyskgl",
"usage": {
"completion_tokens": 10,
"completion_tokens": 19,
"prompt_tokens": 14,
"total_tokens": 7
"total_tokens": 16
},
"choices": [
{
"index": 4,
"index": 1,
"finish_reason": "stop",
"message": {
"role": "system",
"content": "xtrirgreezabshxirfhi",
"content": "vjwamdxrsbqojpolqr",
"tool_calls": [
{
"type": "ChatCompletionsToolCall",
"id": "kicdohgtfw"
"id": "pmmdjgalvahbkafjqir"
}
]
}
Expand Down
Loading

0 comments on commit 1e69395

Please sign in to comment.