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

Merge csharp feature branch into main ai inference branch #29763

Open
wants to merge 59 commits into
base: dargilco/ai-model-inference
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
51fb73b
Update ImageEmbeddingsClient to change embed to embedImage
trangevi May 31, 2024
fd54bf9
Add typespec-csharp to the tspconfig
trangevi May 31, 2024
c53ca69
Merge remote-tracking branch 'upstream/dargilco/ai-model-inference' i…
trangevi Jun 4, 2024
08c7c64
Move csharp client property renames
trangevi Jun 5, 2024
ab6c309
Missing semicolons
trangevi Jun 5, 2024
4f8a7ea
Wrong namespace
trangevi Jun 5, 2024
be84fda
Incorrect namespaces
trangevi Jun 5, 2024
4f56fb3
Aliases need to have things referenced differently, apparently
trangevi Jun 5, 2024
db6580b
Need to specify parameters?
trangevi Jun 5, 2024
a5b3fbc
Move alias renames to the individual file for now
trangevi Jun 5, 2024
234a992
Merge branch 'dargilco/ai-model-inference' into trangevi/ai-model-inf…
trangevi Jun 12, 2024
1c552f3
Change ChatCompletionsOptions to a model
trangevi Jun 20, 2024
8e420b9
syntax
trangevi Jun 20, 2024
420cdf6
Merge branch 'dargilco/ai-model-inference' into trangevi/ai-model-inf…
trangevi Jun 21, 2024
8c122c5
Leave the model property
trangevi Jun 21, 2024
e6e24a1
Add additional properties for ChatCompletionsOptions
trangevi Jun 27, 2024
c33085f
3 dots, not 2
trangevi Jun 27, 2024
bc2ead4
Can't add docstring to generic spread property
trangevi Jun 27, 2024
cea8c46
Change unknown parameters to extra parameters
trangevi Jul 2, 2024
e5f72fe
Merge branch 'dargilco/ai-model-inference' into trangevi/ai-model-inf…
trangevi Jul 9, 2024
69c429f
Remove unnecessary rename
trangevi Jul 9, 2024
9353cd8
Removing api-key change for python, for now
trangevi Jul 11, 2024
404726c
Merge branch 'main' into trangevi/ai-model-inference
trangevi Jul 12, 2024
440f104
Merge branch 'dargilco/ai-model-inference' into trangevi/ai-model-inf…
trangevi Jul 23, 2024
acd2c9a
Make operator method internal
trangevi Jul 23, 2024
7e90c46
Fix pass-through header
trangevi Jul 25, 2024
6525a08
Re-enable protocol methods for csharp
trangevi Jul 26, 2024
c625ccb
Remove "spread" for ChatCompletionsOptions
trangevi Jul 26, 2024
b3ff7cf
Remove spread for additionalRequestHeaders
trangevi Jul 26, 2024
3cad35a
needed commas
trangevi Jul 26, 2024
4d8fe2c
another formatting attempt
trangevi Jul 26, 2024
442e62e
okay, figured out how the formatting works
trangevi Jul 26, 2024
eba14da
Alias breaks the generator
trangevi Jul 26, 2024
4a3dfd2
A model won't give us the interaction pattern that we want. Trying this.
trangevi Jul 26, 2024
392243f
Forgot semicolon
trangevi Jul 26, 2024
156d4e0
Merge branch 'dargilco/ai-model-inference' into trangevi/ai-model-inf…
trangevi Jul 29, 2024
72ff5d0
Does swapping the order of parameters matter?
trangevi Jul 29, 2024
063b051
Make extraParams optional?
trangevi Jul 29, 2024
dd47e68
Try and get rid of anonymous model
trangevi Jul 29, 2024
1f62242
Try adding RequestHeadersTrait
trangevi Jul 29, 2024
7254471
Maybe needs to be an object?
trangevi Jul 29, 2024
d752df6
Add using
trangevi Jul 29, 2024
4039eb1
Revert to "good" state
trangevi Jul 30, 2024
33fb66c
Merge branch 'dargilco/ai-model-inference' into trangevi/ai-model-inf…
trangevi Aug 5, 2024
d2d069e
Merge branch 'dargilco/ai-model-inference' into trangevi/ai-model-inf…
trangevi Aug 8, 2024
7b1e6e1
Try moving extra parameters. Change Parameters back to unknown
trangevi Aug 13, 2024
65239b3
Skip the alias
trangevi Aug 13, 2024
323366c
Is it the header which is causing issues?
trangevi Aug 13, 2024
1562993
Headers in the options object seems to not work
trangevi Aug 13, 2024
bd9d308
Remove commented operation
trangevi Aug 13, 2024
7e3d4fd
Unnecessary using
trangevi Aug 13, 2024
9b2fbf0
Merge branch 'dargilco/ai-model-inference' into trangevi/ai-model-inf…
trangevi Aug 23, 2024
376a388
Add embeddings for csharp
trangevi Aug 23, 2024
b2d19d3
Merge branch 'dargilco/ai-model-inference' into trangevi/ai-model-inf…
trangevi Aug 23, 2024
56e81a8
Client changes for C#
trangevi Aug 26, 2024
b1d22e9
Need the options objects to be models
trangevi Aug 26, 2024
fb263d7
Make the embedding methods public for now, for intial testing
trangevi Aug 28, 2024
2ef0546
Remove image embedding for now until it can be tested
trangevi Aug 29, 2024
aa97e50
Add new streaming classes for C#
trangevi Sep 27, 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
4 changes: 4 additions & 0 deletions specification/ai/ModelClient/client.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,7 @@ interface Client3 {
embed is AI.Model.getImageEmbeddings;
getModelInfo is AI.Model.getModelInfo;
}

// The following is to update names as necessary for specific programming languages.
// Done in this file to provide a single point of reference for any renames.
@@clientName(ModelClient.StreamingChatChoiceUpdate.delta, "InternalStreamingDeltaMessage", "csharp");
trangevi marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 12 additions & 3 deletions specification/ai/ModelClient/models/chat_completions.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ using Azure.ClientGenerator.Core;

namespace AI.Model;

alias ChatCompletionsOptions = {
@doc("""
The configuration information for a chat completions request.
Completions support a wide variety of tasks and generate text that continues from or "completes"
provided prompt data.
""")
model ChatCompletionsOptions {
@doc("""
The collection of context messages associated with this chat completions request.
Typical usage begins with a chat message for the System role that provides instructions for
Expand All @@ -33,6 +38,7 @@ alias ChatCompletionsOptions = {
@doc("""
A value indicating whether chat completions should be streamed for this request.
""")
@clientName("InternalShouldStreamResponse", "csharp")
stream?: boolean;

@doc("""
Expand Down Expand Up @@ -69,6 +75,7 @@ alias ChatCompletionsOptions = {
""")
@maxValue(1.0)
@minValue(0.0)
@clientName("NucleusSamplingFactor", "csharp")
top_p?: float32 = 1.0;

@doc("The maximum number of tokens to generate.")
Expand All @@ -82,6 +89,7 @@ alias ChatCompletionsOptions = {
A collection of textual sequences that will end completions generation.
""")
@minItems(1)
@clientName("StopSequences", "csharp")
stop?: string[];

@doc("The available tool definitions that the chat completions request can use, including caller-defined functions.")
Expand All @@ -103,9 +111,10 @@ alias ChatCompletionsOptions = {
@doc("""
ID of the specific AI model to use, if more than one model is available on the endpoint.
""")
@clientName("DeploymentName", "csharp")
`model`?: string;
};

...Record<unknown>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be limited to C# only?

}

alias ChatCompletionsCommon = {
@doc("A unique identifier associated with this chat completions response.")
Expand Down
8 changes: 4 additions & 4 deletions specification/ai/ModelClient/models/common.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,16 @@ alias AdditionalRequestHeaders = {
extra_params?: ExtraParameters;
};

@doc("Controls what happens if extra parameters, undefined byt he REST ApI are passed in the JSON request payload.")
@doc("Controls what happens if extra parameters, undefined by the REST ApI are passed in the JSON request payload.")
union ExtraParameters {
string,

@doc("The service will error if it detected unknown parameters in the request payload. This is the service default.")
@doc("The service will error if it detected extra parameters in the request payload. This is the service default.")
error: "error",

@doc("The service will ignore (drop) unknown parameters in the request payload. It will only pass the known parameters to the back-end AI model.")
@doc("The service will ignore (drop) extra parameters in the request payload. It will only pass the known parameters to the back-end AI model.")
drop: "drop",

@doc("The service will pass unknown parameters to the back-end AI model.")
@doc("The service will pass extra parameters to the back-end AI model.")
pass_through: "pass_through",
}
7 changes: 7 additions & 0 deletions specification/ai/ModelClient/tspconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ options:
package-dir: "azure-ai-inference"
package-name: "{package-dir}"
flavor: azure
"@azure-tools/typespec-csharp":
package-dir: "Azure.AI.Inference"
namespace: "Azure.AI.Inference"
clear-output-folder: true
model-namespace: false
generate-protocol-methods: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see "Krzysztof Cwalina" [email protected] is OOF until 7/22... he was asking why we are not generating the protocol methods. I asked if they are needed by all SDKs, and why. I don't think he answered that question (perhaps he left for vacation before he could answer). But anyway, this is where we would enable them. Okay to leave it "false" for now.

flavor: azure
Loading