Skip to content

Commit fc67d98

Browse files
author
SDKAuto
committed
CodeGen from PR 3482 in test-repo-billy/azure-rest-api-specs
Merge 6c7f4231c72f34d93168540dea930f470444330e into 2b91022c223ed3618c268c750f831b76fe0f4fb5
1 parent 6036699 commit fc67d98

File tree

6 files changed

+876
-0
lines changed

6 files changed

+876
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT license.
3+
4+
import { TokenCredential, KeyCredential } from "@azure/core-auth";
5+
import { ClientOptions, Client, getClient } from "@azure-rest/core-client";
6+
import { logger } from "../logger.js";
7+
8+
export interface AssistantsContext extends Client {}
9+
10+
/** Optional parameters for the client. */
11+
export interface AssistantsClientOptionalParams extends ClientOptions {}
12+
13+
/** Azure OpenAI APIs for Assistants. */
14+
export function createAssistants(
15+
endpointParam: string,
16+
credential: KeyCredential | TokenCredential,
17+
options: AssistantsClientOptionalParams = {},
18+
): AssistantsContext {
19+
const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}`;
20+
21+
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
22+
const userAgentPrefix = prefixFromOptions
23+
? `${prefixFromOptions} azsdk-js-api`
24+
: "azsdk-js-api";
25+
const { apiVersion: _, ...updatedOptions } = {
26+
...options,
27+
userAgentOptions: { userAgentPrefix },
28+
loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },
29+
credentials: {
30+
scopes: options.credentials?.scopes ?? [
31+
"https://cognitiveservices.azure.com/.default",
32+
],
33+
apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "api-key",
34+
},
35+
};
36+
const clientContext = getClient(endpointUrl, credential, updatedOptions);
37+
clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" });
38+
if (options.apiVersion) {
39+
logger.warning(
40+
"This client does not support client api-version, please change it at the operation level",
41+
);
42+
}
43+
return clientContext;
44+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT license.
3+
4+
export {
5+
createAssistants,
6+
AssistantsContext,
7+
AssistantsClientOptionalParams,
8+
} from "./assistantsContext.js";
9+
export {
10+
createAssistant,
11+
listAssistants,
12+
getAssistant,
13+
updateAssistant,
14+
deleteAssistant,
15+
createThread,
16+
getThread,
17+
updateThread,
18+
deleteThread,
19+
createMessage,
20+
listMessages,
21+
getMessage,
22+
updateMessage,
23+
createRun,
24+
listRuns,
25+
getRun,
26+
updateRun,
27+
submitToolOutputsToRun,
28+
cancelRun,
29+
createThreadAndRun,
30+
getRunStep,
31+
listRunSteps,
32+
listFiles,
33+
uploadFile,
34+
deleteFile,
35+
getFile,
36+
getFileContent,
37+
listVectorStores,
38+
createVectorStore,
39+
getVectorStore,
40+
modifyVectorStore,
41+
deleteVectorStore,
42+
listVectorStoreFiles,
43+
createVectorStoreFile,
44+
getVectorStoreFile,
45+
deleteVectorStoreFile,
46+
createVectorStoreFileBatch,
47+
getVectorStoreFileBatch,
48+
cancelVectorStoreFileBatch,
49+
listVectorStoreFileBatchFiles,
50+
} from "./operations.js";

0 commit comments

Comments
 (0)