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QAAA,iBAAA,YAAA,EAAA,IAAA,kBAAA,QAAA,aAAa,IACb,OAAA,eAAA,QAAA,iBAAA,YAAA,EAAA,IAAA,kBAAA,QAAA,aAAa,IACb,OAAA,eAAA,QAAA,kBAAA,YAAA,EAAA,IAAA,kBAAA,QAAA,cAAc,IACd,OAAA,eAAA,QAAA,mBAAA,YAAA,EAAA,IAAA,kBAAA,QAAA,eAAe,IACf,OAAA,eAAA,QAAA,uBAAA,YAAA,EAAA,IAAA,kBAAA,QAAA,mBAAmB,IACnB,OAAA,eAAA,QAAA,uBAAA,YAAA,EAAA,IAAA,kBAAA,QAAA,mBAAmB,IACnB,OAAA,eAAA,QAAA,yBAAA,YAAA,EAAA,IAAA,kBAAA,QAAA,qBAAqB,IACrB,OAAA,eAAA,QAAA,4BAAA,YAAA,EAAA,IAAA,kBAAA,QAAA,wBAAwB,IAG1B,QAAA,OAAA,QAAoB,K","file":"/npm/groq-sdk@0.37.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/groq-sdk@0.37.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.\n\nimport { type Agent } from './_shims/index';\nimport * as Core from './core';\nimport * as Errors from './error';\nimport * as Uploads from './uploads';\nimport * as API from './resources/index';\nimport {\n  BatchCreateParams,\n  BatchCreateResponse,\n  BatchListResponse,\n  BatchRetrieveResponse,\n  Batches,\n} from './resources/batches';\nimport { CompletionUsage, Completions } from './resources/completions';\nimport {\n  CreateEmbeddingResponse,\n  Embedding,\n  EmbeddingCreateParams,\n  Embeddings,\n} from './resources/embeddings';\nimport {\n  FileCreateParams,\n  FileCreateResponse,\n  FileDeleteResponse,\n  FileInfoResponse,\n  FileListResponse,\n  Files,\n} from './resources/files';\nimport { Model, ModelDeleted, ModelListResponse, Models } from './resources/models';\nimport { Audio } from './resources/audio/audio';\nimport { Chat } from './resources/chat/chat';\n\nexport interface ClientOptions {\n  /**\n   * Defaults to process.env['GROQ_API_KEY'].\n   */\n  apiKey?: string | undefined;\n\n  /**\n   * Override the default base URL for the API, e.g., \"https://api.example.com/v2/\"\n   *\n   * Defaults to process.env['GROQ_BASE_URL'].\n   */\n  baseURL?: string | null | undefined;\n\n  /**\n   * The maximum amount of time (in milliseconds) that the client should wait for a response\n   * from the server before timing out a single request.\n   *\n   * Note that request timeouts are retried by default, so in a worst-case scenario you may wait\n   * much longer than this timeout before the promise succeeds or fails.\n   *\n   * @unit milliseconds\n   */\n  timeout?: number | undefined;\n\n  /**\n   * An HTTP agent used to manage HTTP(S) connections.\n   *\n   * If not provided, an agent will be constructed by default in the Node.js environment,\n   * otherwise no agent is used.\n   */\n  httpAgent?: Agent | undefined;\n\n  /**\n   * Specify a custom `fetch` function implementation.\n   *\n   * If not provided, we use `node-fetch` on Node.js and otherwise expect that `fetch` is\n   * defined globally.\n   */\n  fetch?: Core.Fetch | undefined;\n\n  /**\n   * The maximum number of times that the client will retry a request in case of a\n   * temporary failure, like a network error or a 5XX error from the server.\n   *\n   * @default 2\n   */\n  maxRetries?: number | undefined;\n\n  /**\n   * Default headers to include with every request to the API.\n   *\n   * These can be removed in individual requests by explicitly setting the\n   * header to `undefined` or `null` in request options.\n   */\n  defaultHeaders?: Core.Headers | undefined;\n\n  /**\n   * Default query parameters to include with every request to the API.\n   *\n   * These can be removed in individual requests by explicitly setting the\n   * param to `undefined` in request options.\n   */\n  defaultQuery?: Core.DefaultQuery | undefined;\n\n  /**\n   * By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.\n   * Only set this option to `true` if you understand the risks and have appropriate mitigations in place.\n   */\n  dangerouslyAllowBrowser?: boolean | undefined;\n}\n\n/**\n * API Client for interfacing with the Groq API.\n */\nexport class Groq extends Core.APIClient {\n  apiKey: string;\n\n  private _options: ClientOptions;\n\n  /**\n   * API Client for interfacing with the Groq API.\n   *\n   * @param {string | undefined} [opts.apiKey=process.env['GROQ_API_KEY'] ?? undefined]\n   * @param {string} [opts.baseURL=process.env['GROQ_BASE_URL'] ?? https://api.groq.com] - Override the default base URL for the API.\n   * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.\n   * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.\n   * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.\n   * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.\n   * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.\n   * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.\n   * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.\n   */\n  constructor({\n    baseURL = Core.readEnv('GROQ_BASE_URL'),\n    apiKey = Core.readEnv('GROQ_API_KEY'),\n    ...opts\n  }: ClientOptions = {}) {\n    if (apiKey === undefined) {\n      throw new Errors.GroqError(\n        \"The GROQ_API_KEY environment variable is missing or empty; either provide it, or instantiate the Groq client with an apiKey option, like new Groq({ apiKey: 'My API Key' }).\",\n      );\n    }\n\n    const options: ClientOptions = {\n      apiKey,\n      ...opts,\n      baseURL: baseURL || `https://api.groq.com`,\n    };\n\n    if (!options.dangerouslyAllowBrowser && Core.isRunningInBrowser()) {\n      throw new Errors.GroqError(\n        \"It looks like you're running in a browser-like environment.\\n\\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\\nIf you understand the risks and have appropriate mitigations in place,\\nyou can set the `dangerouslyAllowBrowser` option to `true`, e.g.,\\n\\nnew Groq({ apiKey, dangerouslyAllowBrowser: true })\",\n      );\n    }\n\n    super({\n      baseURL: options.baseURL!,\n      baseURLOverridden: baseURL ? baseURL !== 'https://api.groq.com' : false,\n      timeout: options.timeout ?? 60000 /* 1 minute */,\n      httpAgent: options.httpAgent,\n      maxRetries: options.maxRetries,\n      fetch: options.fetch,\n    });\n\n    this._options = options;\n\n    this.apiKey = apiKey;\n  }\n\n  completions: API.Completions = new API.Completions(this);\n  chat: API.Chat = new API.Chat(this);\n  embeddings: API.Embeddings = new API.Embeddings(this);\n  audio: API.Audio = new API.Audio(this);\n  models: API.Models = new API.Models(this);\n  batches: API.Batches = new API.Batches(this);\n  files: API.Files = new API.Files(this);\n\n  /**\n   * Check whether the base URL is set to its default.\n   */\n  #baseURLOverridden(): boolean {\n    return this.baseURL !== 'https://api.groq.com';\n  }\n\n  protected override defaultQuery(): Core.DefaultQuery | undefined {\n    return this._options.defaultQuery;\n  }\n\n  protected override defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers {\n    return {\n      ...super.defaultHeaders(opts),\n      ...this._options.defaultHeaders,\n    };\n  }\n\n  protected override authHeaders(opts: Core.FinalRequestOptions): Core.Headers {\n    return { Authorization: `Bearer ${this.apiKey}` };\n  }\n\n  static Groq = this;\n  static DEFAULT_TIMEOUT = 60000; // 1 minute\n\n  static GroqError = Errors.GroqError;\n  static APIError = Errors.APIError;\n  static APIConnectionError = Errors.APIConnectionError;\n  static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;\n  static APIUserAbortError = Errors.APIUserAbortError;\n  static NotFoundError = Errors.NotFoundError;\n  static ConflictError = Errors.ConflictError;\n  static RateLimitError = Errors.RateLimitError;\n  static BadRequestError = Errors.BadRequestError;\n  static AuthenticationError = Errors.AuthenticationError;\n  static InternalServerError = Errors.InternalServerError;\n  static PermissionDeniedError = Errors.PermissionDeniedError;\n  static UnprocessableEntityError = Errors.UnprocessableEntityError;\n\n  static toFile = Uploads.toFile;\n  static fileFromPath = Uploads.fileFromPath;\n}\n\nGroq.Completions = Completions;\nGroq.Chat = Chat;\nGroq.Embeddings = Embeddings;\nGroq.Audio = Audio;\nGroq.Models = Models;\nGroq.Batches = Batches;\nGroq.Files = Files;\n\nexport declare namespace Groq {\n  export type RequestOptions = Core.RequestOptions;\n\n  export { Completions as Completions, type CompletionUsage as CompletionUsage };\n\n  export { Chat as Chat };\n\n  export {\n    Embeddings as Embeddings,\n    type CreateEmbeddingResponse as CreateEmbeddingResponse,\n    type Embedding as Embedding,\n    type EmbeddingCreateParams as EmbeddingCreateParams,\n  };\n\n  export { Audio as Audio };\n\n  export {\n    Models as Models,\n    type Model as Model,\n    type ModelDeleted as ModelDeleted,\n    type ModelListResponse as ModelListResponse,\n  };\n\n  export {\n    Batches as Batches,\n    type BatchCreateResponse as BatchCreateResponse,\n    type BatchRetrieveResponse as BatchRetrieveResponse,\n    type BatchListResponse as BatchListResponse,\n    type BatchCreateParams as BatchCreateParams,\n  };\n\n  export {\n    Files as Files,\n    type FileCreateResponse as FileCreateResponse,\n    type FileListResponse as FileListResponse,\n    type FileDeleteResponse as FileDeleteResponse,\n    type FileInfoResponse as FileInfoResponse,\n    type FileCreateParams as FileCreateParams,\n  };\n\n  export type ErrorObject = API.ErrorObject;\n  export type FunctionDefinition = API.FunctionDefinition;\n  export type FunctionParameters = API.FunctionParameters;\n}\n\nexport { toFile, fileFromPath } from './uploads';\nexport {\n  GroqError,\n  APIError,\n  APIConnectionError,\n  APIConnectionTimeoutError,\n  APIUserAbortError,\n  NotFoundError,\n  ConflictError,\n  RateLimitError,\n  BadRequestError,\n  AuthenticationError,\n  InternalServerError,\n  PermissionDeniedError,\n  UnprocessableEntityError,\n} from './error';\n\nexport default Groq;\n"]}