Skip to content

Commit 569e444

Browse files
authored
[docs] add aisdk workaround before npm release + add versions to work with LanguageModelV1 + LiteLLM works for python (#1086)
# why 1. aisdk not yet available through npm package 2. customLLM provider only works with LanguageModelV1 3. LiteLLM compatible providers are supported in python # what changed 1. change docs to install stagehand from git repo 2. pin versions that use LanguageModelV1 # test plan local test
1 parent 8ff5c5a commit 569e444

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

docs/configuration/models.mdx

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,46 +156,69 @@ stagehand = Stagehand(
156156
## Custom LLM Integration
157157

158158
<Note>
159-
Custom LLMs are currently only supported in TypeScript.
159+
Only [LiteLLM compatible providers](https://docs.litellm.ai/docs/providers) are available in Python. Some may require extra setup.
160160
</Note>
161161

162162
Integrate any LLM with Stagehand using custom clients. The only requirement is **structured output support** for consistent automation behavior.
163163

164164
### Vercel AI SDK
165165
The [Vercel AI SDK](https://sdk.vercel.ai/providers/ai-sdk-providers) is a popular library for interacting with LLMs. You can use any of the providers supported by the Vercel AI SDK to create a client for your model, **as long as they support structured outputs**.
166166

167-
Vercel AI SDK supports providers for OpenAI, Anthropic, and Google, along with support for **Amazon Bedrock** and **Azure OpenAI**.
167+
Vercel AI SDK supports providers for OpenAI, Anthropic, and Google, along with support for **Amazon Bedrock** and **Azure OpenAI**. For a full list, see the [Vercel AI SDK providers page](https://sdk.vercel.ai/providers/ai-sdk-providers).
168168

169-
To get started, you'll need to install the `ai` package and the provider you want to use. For example, to use Amazon Bedrock, you'll need to install the `@ai-sdk/amazon-bedrock` package.
169+
To get started, you'll need to install the `ai` package (version 4) and the provider you want to use (version 1 - both need to be compatible with LanguageModelV1). For example, to use Amazon Bedrock, you'll need to install the `@ai-sdk/amazon-bedrock` package.
170170

171-
You'll also need to import the [Vercel AI SDK external client](https://github.com/browserbase/stagehand/blob/main/lib/llm/aisdk.ts) which is exposed as `AISdkClient` to create a client for your model.
171+
You'll also need to import the [Vercel AI SDK external client](https://github.com/browserbase/stagehand/blob/main/lib/llm/aisdk.ts) through Stagehand to create a client for your model.
172172

173173
<Tabs>
174174
<Tab title="npm">
175175
```bash
176-
npm install ai @ai-sdk/amazon-bedrock
176+
npm install ai@4 @ai-sdk/amazon-bedrock@1
177177
```
178178
</Tab>
179179

180180
<Tab title="pnpm">
181181
```bash
182-
pnpm install ai @ai-sdk/amazon-bedrock
182+
pnpm install ai@4 @ai-sdk/amazon-bedrock@1
183183
```
184184
</Tab>
185185

186186
<Tab title="yarn">
187187
```bash
188-
yarn add ai @ai-sdk/amazon-bedrock
188+
yarn add ai@4 @ai-sdk/amazon-bedrock@1
189189
```
190190
</Tab>
191191
</Tabs>
192192

193-
To get started, you can use the [Vercel AI SDK external client](https://github.com/browserbase/stagehand/blob/main/lib/llm/aisdk.ts) which is exposed as `AISdkClient` to create a client for your model.
193+
<Note>
194+
The `AISdkClient` is not yet available via the Stagehand npm package. For now, install Stagehand as a git repository to access the `AISdkClient` (this will be included in the npm package in an upcoming release).
195+
</Note>
196+
197+
<Tabs>
198+
<Tab title="npm">
199+
```bash
200+
npm install @browserbasehq/stagehand@git+https://github.com/browserbase/stagehand.git
201+
```
202+
</Tab>
203+
204+
<Tab title="pnpm">
205+
```bash
206+
pnpm install @browserbasehq/stagehand@git+https://github.com/browserbase/stagehand.git
207+
```
208+
</Tab>
209+
210+
<Tab title="yarn">
211+
```bash
212+
yarn add @browserbasehq/stagehand@git+https://github.com/browserbase/stagehand.git
213+
```
214+
</Tab>
215+
</Tabs>
194216

195217
```ts
196218
// Install/import the provider you want to use.
197-
// For example, to use OpenAI, import `openai` from @ai-sdk/openai
219+
// For example, to use Azure OpenAI, import { createAzure } from '@ai-sdk/azure';
198220
import { bedrock } from "@ai-sdk/amazon-bedrock";
221+
// @ts-ignore
199222
import { AISdkClient } from "@browserbasehq/stagehand";
200223

201224
const stagehand = new Stagehand({

0 commit comments

Comments
 (0)