UNPKG

@azure/openai-assistants

Version:

An isomorphic client library for Azure OpenAI Assistants.

36 lines 2 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT license. /** * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT! * * Any changes you make here may be lost. * * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom */ import { getClient } from "@azure-rest/core-client"; import { logger } from "../logger.js"; /** * Initialize a new instance of `AssistantsContext` * @param endpoint - An OpenAI endpoint supporting assistants functionality. * @param credentials - uniquely identify client credential * @param options - the parameter for all optional parameters */ export default function createClient(endpoint, credentials, options = {}) { var _a, _b, _c, _d, _e, _f, _g, _h; const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${endpoint}/openai`; options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2024-02-15-preview"; const userAgentInfo = `azsdk-js-openai-assistants-rest/1.0.0-beta.6`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` : `${userAgentInfo}`; options = Object.assign(Object.assign({}, options), { userAgentOptions: { userAgentPrefix, }, loggingOptions: { logger: (_d = (_c = options.loggingOptions) === null || _c === void 0 ? void 0 : _c.logger) !== null && _d !== void 0 ? _d : logger.info, }, credentials: { scopes: (_f = (_e = options.credentials) === null || _e === void 0 ? void 0 : _e.scopes) !== null && _f !== void 0 ? _f : ["https://cognitiveservices.azure.com/.default"], apiKeyHeaderName: (_h = (_g = options.credentials) === null || _g === void 0 ? void 0 : _g.apiKeyHeaderName) !== null && _h !== void 0 ? _h : "api-key", } }); return getClient(baseUrl, credentials, options); } //# sourceMappingURL=assistantsClient.js.map