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

Feature/openai add missing usage #22337

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion specification/cognitiveservices/OpenAI.Inference/main.cadl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ https://westus.api.cognitive.microsoft.com).
)
@versioned(ServiceApiVersions)
@versionedDependency(
[[ServiceApiVersions.v2022_06_01_preview, Azure.Core.Versions.v1_0_Preview_1]]
[
[
ServiceApiVersions.v2022_06_01_preview,
Azure.Core.Versions.v1_0_Preview_1
]
]
)
@doc("Azure OpenAI APIs for completions and search")
namespace Azure.OpenAI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ model Completions {
"model"?: string;
@doc("Array of choices returned containing text completions to prompts sent")
choices?: Choice[];
@doc("Usage counts for tokens input using the completions API")
usage: CompletionsUsage;
}

@doc("Choice model within completion response")
Expand All @@ -163,3 +165,13 @@ model CompletionsLogProbsModel {
@doc("Text offset")
text_offset?: int32[];
}

@doc("Measurment of the amount of tokens used in this request and response")
model CompletionsUsage {
@doc("Number of tokens received in the completion")
completion_token: int32,
@doc("Number of tokens sent in the original request")
prompt_tokens: int32,
@doc("Total number of tokens transacted in this request/response")
total_tokens: int32
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,26 @@ model EmbeddingsOptions {
as we have observed inferior results when newlines are present.
""")
input: string | string[];

@doc("Usage counts for tokens input using the embeddings API")
usage: EmbeddingsUsage;
};

model Embeddings {
object: "list",
data: EmbeddingItem[],
}

model Usage {
prompt_tokens: int32,
total_tokens: int32
}

model EmbeddingItem {
object: "embedding",
embedding: float32[];
index: int32;
}

@doc("Measurment of the amount of tokens used in this request and response")
model EmbeddingsUsage {
@doc("Number of tokens sent in the original request")
prompt_tokens: int32,
@doc("Total number of tokens transacted in this request/response")
total_tokens: int32
}