You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7321660
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: packages/ai/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -303,8 +303,8 @@ continuation. Explicit caches, hosted tools, and generated media are not support
303
303
304
304
A provider also builds a model for each other kind it serves: `provider.image(id)`, `video`, `speech`,
305
305
`transcription`, `decision` and `embedding`, each on that kind's first API, with `{ api }` naming another when it has
306
-
several. A provider without a kind has no accessor for it (`anthropic().video` is a type error), and
307
-
`provider.model(id, { api })` still builds any of them. `ai.image.generate` resolves the provider's image route from the
306
+
several. A provider without a kind has no accessor for it (`anthropic().video` is a type error), and`provider.model`
307
+
is the language accessor, so a provider with no language API has none. `ai.image.generate` resolves the provider's image route from the
308
308
model and returns `Media.Asset`s with lazily decoded bytes:
309
309
310
310
```ts
@@ -1863,7 +1863,7 @@ Normalized cache usage is read back into `response.usage.cacheReadInputTokens` a
1863
1863
1864
1864
## Providers
1865
1865
1866
-
A provider is a function from settings to a provider value. Settings are the connection keys (`apiKey`, `baseURL`, `headers`, `body`), the provider's own settings and its default API's provider options; any other key is a type error, and other provider options go in `native` (`openai({ native: { custom: true } })`). `Provider.SettingsOf<typeof openai>` is that type, derived from the provider. A package path's `model(modelID, settings)` takes settings as config files write them: every key it doesn't read is sent as a provider option. `provider.model(id)` returns a model on the provider's first language API, and `provider.model(id, { api })` picks another API by name. `provider.image(id)`, `video`, `speech`, `transcription`, `decision` and `embedding` return a model on that kind's first API (or the one `{ api }` names), and exist only for the kinds the provider serves. The model holds its API with the host's base URL, auth and the key its `native` metadata goes under. Making a provider reads nothing: API keys and other environment fallbacks (`AWS_REGION`, Google Vertex's project and location) are read when a request is sent, and bad settings fail that request with a typed error.
1866
+
A provider is a function from settings to a provider value. Settings are the connection keys (`apiKey`, `baseURL`, `headers`, `body`), the provider's own settings and its default API's provider options; any other key is a type error, and other provider options go in `native` (`openai({ native: { custom: true } })`). `Provider.SettingsOf<typeof openai>` is that type, derived from the provider. A package path's `model(modelID, settings)` takes settings as config files write them: every key it doesn't read is sent as a provider option. `provider.model(id)` returns a model on the provider's first language API, and `provider.model(id, { api })` picks another language API by name. `provider.image(id)`, `video`, `speech`, `transcription`, `decision` and `embedding` return a model on that kind's first API (or the one `{ api }` names). Each accessor, `model` included, exists only for the kinds the provider serves, and naming an API of another kind is a type error (an `AIError` with an `UnsupportedOperation` reason for untyped callers). The model holds its API with the host's base URL, auth and the key its `native` metadata goes under. Making a provider reads nothing: API keys and other environment fallbacks (`AWS_REGION`, Google Vertex's project and location) are read when a request is sent, and bad settings fail that request with a typed error.
0 commit comments