Skip to content

Commit

Permalink
Move Python class renaming to client.tsp
Browse files Browse the repository at this point in the history
  • Loading branch information
dargilco committed Jun 10, 2024
1 parent 36d9e57 commit 4ee5306
Show file tree
Hide file tree
Showing 18 changed files with 141 additions and 122 deletions.
23 changes: 23 additions & 0 deletions specification/ai/ModelClient/client.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,29 @@ namespace Customizations; // The actual name here doesn't matter and is here for
@@access(ModelClient.getImageEmbeddings, Access.internal, "python");
@@access(ModelClient.getModelInfo, Access.internal, "python");

// We use shorter names in the Python client library
@@clientName(ModelClient.ChatRequestSystemMessage, "SystemMessage", "python");
@@clientName(ModelClient.ChatRequestUserMessage, "UserMessage", "python");
@@clientName(ModelClient.ChatRequestAssistantMessage,
"AssistantMessage",
"python"
);
@@clientName(ModelClient.ChatRequestToolMessage, "ToolMessage", "python");
@@clientName(ModelClient.ChatMessageContentItem, "ContentItem", "python");
@@clientName(ModelClient.ChatMessageTextContentItem,
"TextContentItem",
"python"
);
@@clientName(ModelClient.ChatMessageImageContentItem,
"ImageContentItem",
"python"
);
@@clientName(ModelClient.ChatMessageImageUrl, "ImageUrl", "python");
@@clientName(ModelClient.ChatMessageImageDetailLevel,
"ImageDetailLevel",
"python"
);

@client({
name: "ChatCompletionsClient",
service: ModelClient,
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": -1,
"temperature": 0,
"top_p": 0,
"max_tokens": 0,
"response_format": "text",
"stop": [
"hyjmwlrxwyixwbx"
"frovutrcmwrzcoszelrglkuvpbukzu"
],
"tools": [
{
"type": "ChatCompletionsToolDefinition"
}
],
"seed": 22
"seed": 6
}
},
"responses": {
"200": {
"body": {
"id": "xljaucrjqaqjipmc",
"created": 29,
"model": "q",
"id": "hpcvgnonpjyzffximnagg",
"created": 27,
"model": "iextgrfegfy",
"usage": {
"completion_tokens": 18,
"prompt_tokens": 12,
"total_tokens": 8
"completion_tokens": 22,
"prompt_tokens": 9,
"total_tokens": 7
},
"choices": [
{
"index": 12,
"index": 10,
"finish_reason": "stop",
"message": {
"role": "system",
"content": "bvltz",
"content": "kjzmsqcgjl",
"tool_calls": [
{
"type": "ChatCompletionsToolCall",
"id": "zoerkv"
"id": "maltrnwbhsjytwjfgxdshcbwup"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
"responses": {
"200": {
"body": {
"id": "xljaucrjqaqjipmc",
"created": 29,
"model": "q",
"id": "hpcvgnonpjyzffximnagg",
"created": 27,
"model": "iextgrfegfy",
"usage": {
"completion_tokens": 18,
"prompt_tokens": 12,
"total_tokens": 8
"completion_tokens": 22,
"prompt_tokens": 9,
"total_tokens": 7
},
"choices": [
{
"index": 12,
"index": 10,
"finish_reason": "stop",
"message": {
"role": "system",
"content": "bvltz"
"content": "kjzmsqcgjl"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@
"unknown-parameters": "error",
"body": {
"input": [
"wlux"
"mhldnzatps"
],
"dimensions": 27,
"dimensions": 28,
"encoding_format": "base64",
"input_type": "text"
}
},
"responses": {
"200": {
"body": {
"id": "kedirjyccyaebyn",
"id": "eydebtydwpajdafhqiqtfdklcgrln",
"data": [
{
"embedding": [
16
15
],
"index": 18
"index": 7
}
],
"usage": {
"input_tokens": 21,
"prompt_tokens": 6,
"total_tokens": 16
"input_tokens": 18,
"prompt_tokens": 30,
"total_tokens": 30
},
"model": "zdfajtcsw"
"model": "bxrwbixgoipxiqouemwamsccfmpwut"
}
}
}
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": [
"gpopqlqlmaqsmnndd"
"mjcfkghomsiauazvrqizay"
]
}
},
"responses": {
"200": {
"body": {
"id": "kedirjyccyaebyn",
"id": "eydebtydwpajdafhqiqtfdklcgrln",
"data": [
{
"embedding": [
16
15
],
"index": 18
"index": 7
}
],
"usage": {
"input_tokens": 21,
"prompt_tokens": 6,
"total_tokens": 16
"input_tokens": 18,
"prompt_tokens": 30,
"total_tokens": 30
},
"model": "zdfajtcsw"
"model": "bxrwbixgoipxiqouemwamsccfmpwut"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@
"body": {
"input": [
{
"image": "grfazklprgwztlcy",
"text": "alnrjrixfnv"
"image": "eplktjwsrhtw",
"text": "esoizlgwokdrrxvlmtz"
}
],
"dimensions": 4,
"dimensions": 27,
"encoding_format": "base64",
"input_type": "text"
}
},
"responses": {
"200": {
"body": {
"id": "kedirjyccyaebyn",
"id": "eydebtydwpajdafhqiqtfdklcgrln",
"data": [
{
"embedding": [
16
15
],
"index": 18
"index": 7
}
],
"usage": {
"input_tokens": 21,
"prompt_tokens": 6,
"total_tokens": 16
"input_tokens": 18,
"prompt_tokens": 30,
"total_tokens": 30
},
"model": "zdfajtcsw"
"model": "bxrwbixgoipxiqouemwamsccfmpwut"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@
"body": {
"input": [
{
"image": "grfazklprgwztlcy"
"image": "eplktjwsrhtw"
}
]
}
},
"responses": {
"200": {
"body": {
"id": "kedirjyccyaebyn",
"id": "eydebtydwpajdafhqiqtfdklcgrln",
"data": [
{
"embedding": [
16
15
],
"index": 18
"index": 7
}
],
"usage": {
"input_tokens": 21,
"prompt_tokens": 6,
"total_tokens": 16
"input_tokens": 18,
"prompt_tokens": 30,
"total_tokens": 30
},
"model": "zdfajtcsw"
"model": "bxrwbixgoipxiqouemwamsccfmpwut"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"responses": {
"200": {
"body": {
"model_name": "ayxxrduegvgjomzmfcpndvdmvg",
"model_name": "aakbqaphhuvebuxpcrve",
"model_type": "embeddings",
"model_provider_name": "sursnucghq"
"model_provider_name": "mokbftoapmemqczizfxzibtt"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"responses": {
"200": {
"body": {
"model_name": "ayxxrduegvgjomzmfcpndvdmvg",
"model_name": "aakbqaphhuvebuxpcrve",
"model_type": "embeddings",
"model_provider_name": "sursnucghq"
"model_provider_name": "mokbftoapmemqczizfxzibtt"
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions specification/ai/ModelClient/models/chat_completions.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ model ChatRequestMessage {
A request chat message containing system instructions that influence how the model will generate a chat completions
response.
""")
@clientName("SystemMessage", "python")
model ChatRequestSystemMessage extends ChatRequestMessage {
@doc("The chat role associated with this message, which is always 'system' for system messages.")
role: ChatRole.system;
Expand All @@ -289,7 +288,6 @@ model ChatRequestSystemMessage extends ChatRequestMessage {
}

@doc("A request chat message representing user input to the assistant.")
@clientName("UserMessage", "python")
model ChatRequestUserMessage extends ChatRequestMessage {
@doc("The chat role associated with this message, which is always 'user' for user messages.")
role: ChatRole.user;
Expand All @@ -300,7 +298,6 @@ model ChatRequestUserMessage extends ChatRequestMessage {
}

@doc("A request chat message representing response or action from the assistant.")
@clientName("AssistantMessage", "python")
model ChatRequestAssistantMessage extends ChatRequestMessage {
@doc("The chat role associated with this message, which is always 'assistant' for assistant messages.")
role: ChatRole.assistant;
Expand All @@ -318,7 +315,6 @@ model ChatRequestAssistantMessage extends ChatRequestMessage {
}

@doc("A request chat message representing requested output from a configured tool.")
@clientName("ToolMessage", "python")
model ChatRequestToolMessage extends ChatRequestMessage {
@doc("The chat role associated with this message, which is always 'tool' for tool messages.")
role: ChatRole.tool;
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": -1,
"temperature": 0,
"top_p": 0,
"max_tokens": 0,
"response_format": "text",
"stop": [
"hyjmwlrxwyixwbx"
"frovutrcmwrzcoszelrglkuvpbukzu"
],
"tools": [
{
"type": "ChatCompletionsToolDefinition"
}
],
"seed": 22
"seed": 6
}
},
"responses": {
"200": {
"body": {
"id": "xljaucrjqaqjipmc",
"created": 29,
"model": "q",
"id": "hpcvgnonpjyzffximnagg",
"created": 27,
"model": "iextgrfegfy",
"usage": {
"completion_tokens": 18,
"prompt_tokens": 12,
"total_tokens": 8
"completion_tokens": 22,
"prompt_tokens": 9,
"total_tokens": 7
},
"choices": [
{
"index": 12,
"index": 10,
"finish_reason": "stop",
"message": {
"role": "system",
"content": "bvltz",
"content": "kjzmsqcgjl",
"tool_calls": [
{
"type": "ChatCompletionsToolCall",
"id": "zoerkv"
"id": "maltrnwbhsjytwjfgxdshcbwup"
}
]
}
Expand Down
Loading

0 comments on commit 4ee5306

Please sign in to comment.