@ai-sdk/openai
Advanced tools
Comparing version 0.0.66 to 0.0.67
@@ -1342,5 +1342,6 @@ "use strict"; | ||
function createOpenAI(options = {}) { | ||
var _a, _b, _c; | ||
var _a, _b, _c, _d; | ||
const baseURL = (_b = (0, import_provider_utils7.withoutTrailingSlash)((_a = options.baseURL) != null ? _a : options.baseUrl)) != null ? _b : "https://api.openai.com/v1"; | ||
const compatibility = (_c = options.compatibility) != null ? _c : "compatible"; | ||
const providerName = (_d = options.name) != null ? _d : "openai"; | ||
const getHeaders = () => ({ | ||
@@ -1357,3 +1358,3 @@ Authorization: `Bearer ${(0, import_provider_utils7.loadApiKey)({ | ||
const createChatModel = (modelId, settings = {}) => new OpenAIChatLanguageModel(modelId, settings, { | ||
provider: "openai.chat", | ||
provider: `${providerName}.chat`, | ||
url: ({ path }) => `${baseURL}${path}`, | ||
@@ -1365,3 +1366,3 @@ headers: getHeaders, | ||
const createCompletionModel = (modelId, settings = {}) => new OpenAICompletionLanguageModel(modelId, settings, { | ||
provider: "openai.completion", | ||
provider: `${providerName}.completion`, | ||
url: ({ path }) => `${baseURL}${path}`, | ||
@@ -1373,3 +1374,3 @@ headers: getHeaders, | ||
const createEmbeddingModel = (modelId, settings = {}) => new OpenAIEmbeddingModel(modelId, settings, { | ||
provider: "openai.embedding", | ||
provider: `${providerName}.embedding`, | ||
url: ({ path }) => `${baseURL}${path}`, | ||
@@ -1376,0 +1377,0 @@ headers: getHeaders, |
# @ai-sdk/openai | ||
## 0.0.67 | ||
### Patch Changes | ||
- 39fccee: feat (provider/openai): provider name can be changed for 3rd party openai compatible providers | ||
## 0.0.66 | ||
@@ -4,0 +10,0 @@ |
@@ -247,2 +247,6 @@ import { LanguageModelV1, ProviderV1, EmbeddingModelV1 } from '@ai-sdk/provider'; | ||
/** | ||
Provider name. Overrides the `openai` default name for 3rd party providers. | ||
*/ | ||
name?: string; | ||
/** | ||
Custom fetch implementation. You can use it as a middleware to intercept requests, | ||
@@ -249,0 +253,0 @@ or to provide a custom fetch implementation for e.g. testing. |
@@ -1342,5 +1342,6 @@ "use strict"; | ||
function createOpenAI(options = {}) { | ||
var _a, _b, _c; | ||
var _a, _b, _c, _d; | ||
const baseURL = (_b = (0, import_provider_utils7.withoutTrailingSlash)((_a = options.baseURL) != null ? _a : options.baseUrl)) != null ? _b : "https://api.openai.com/v1"; | ||
const compatibility = (_c = options.compatibility) != null ? _c : "compatible"; | ||
const providerName = (_d = options.name) != null ? _d : "openai"; | ||
const getHeaders = () => ({ | ||
@@ -1357,3 +1358,3 @@ Authorization: `Bearer ${(0, import_provider_utils7.loadApiKey)({ | ||
const createChatModel = (modelId, settings = {}) => new OpenAIChatLanguageModel(modelId, settings, { | ||
provider: "openai.chat", | ||
provider: `${providerName}.chat`, | ||
url: ({ path }) => `${baseURL}${path}`, | ||
@@ -1365,3 +1366,3 @@ headers: getHeaders, | ||
const createCompletionModel = (modelId, settings = {}) => new OpenAICompletionLanguageModel(modelId, settings, { | ||
provider: "openai.completion", | ||
provider: `${providerName}.completion`, | ||
url: ({ path }) => `${baseURL}${path}`, | ||
@@ -1373,3 +1374,3 @@ headers: getHeaders, | ||
const createEmbeddingModel = (modelId, settings = {}) => new OpenAIEmbeddingModel(modelId, settings, { | ||
provider: "openai.embedding", | ||
provider: `${providerName}.embedding`, | ||
url: ({ path }) => `${baseURL}${path}`, | ||
@@ -1376,0 +1377,0 @@ headers: getHeaders, |
{ | ||
"name": "@ai-sdk/openai", | ||
"version": "0.0.66", | ||
"version": "0.0.67", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
618551
7190