Skip to content

Commit

Permalink
CodeGen from PR 29967 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 295994a299352ed0eb14713688057648cd675ec1 into 35f4b35e7a4cb4fed48d0edd03266c8407e3246d
  • Loading branch information
SDKAuto committed Jul 25, 2024
1 parent fe18ae3 commit 4d589c9
Show file tree
Hide file tree
Showing 26 changed files with 8,324 additions and 957 deletions.
2 changes: 2 additions & 0 deletions sdk/openai/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ pr:
- feature/*
- release/*
- hotfix/*
exclude:
- feature/v4
paths:
include:
- sdk/openai/
Expand Down
25 changes: 19 additions & 6 deletions sdk/openai/openai/api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "dist/esm/index.d.ts",
"docModel": { "enabled": true },
"apiReport": { "enabled": true, "reportFolder": "./review" },
"docModel": {
"enabled": true
},
"apiReport": {
"enabled": true,
"reportFolder": "./review"
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "",
"publicTrimmedFilePath": "./dist/openai.d.ts"
},
"messages": {
"tsdocMessageReporting": { "default": { "logLevel": "none" } },
"tsdocMessageReporting": {
"default": {
"logLevel": "none"
}
},
"extractorMessageReporting": {
"ae-missing-release-tag": { "logLevel": "none" },
"ae-unresolved-link": { "logLevel": "none" }
"ae-missing-release-tag": {
"logLevel": "none"
},
"ae-unresolved-link": {
"logLevel": "none"
}
}
}
}
}
2 changes: 1 addition & 1 deletion sdk/openai/openai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@
},
"type": "module",
"module": "./dist/esm/index.js"
}
}
19 changes: 19 additions & 0 deletions sdk/openai/openai/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

export {
createOpenAI,
OpenAIClientOptionalParams,
OpenAIContext,
} from "./openAIContext.js";
export {
getAudioTranscriptionAsPlainText,
getAudioTranscriptionAsResponseObject,
getAudioTranslationAsPlainText,
getAudioTranslationAsResponseObject,
getCompletions,
getChatCompletions,
getImageGenerations,
generateSpeechFromText,
getEmbeddings,
} from "./operations.js";
29 changes: 29 additions & 0 deletions sdk/openai/openai/src/api/openAIContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { TokenCredential, KeyCredential } from "@azure/core-auth";
import { ClientOptions } from "@azure-rest/core-client";
import { OpenAIContext } from "../rest/index.js";
import getClient from "../rest/index.js";

/** Optional parameters for the client. */
export interface OpenAIClientOptionalParams extends ClientOptions {}

export { OpenAIContext } from "../rest/index.js";

export function createOpenAI(
endpointParam: string,
credential: KeyCredential | TokenCredential,
options: OpenAIClientOptionalParams = {},
): OpenAIContext {
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
const userAgentPrefix = prefixFromOptions
? `${prefixFromOptions} azsdk-js-api`
: "azsdk-js-api";

const clientContext = getClient(endpointParam, credential, {
...options,
userAgentOptions: { userAgentPrefix },
});
return clientContext;
}
Loading

0 comments on commit 4d589c9

Please sign in to comment.