midscene
midscene copied to clipboard
[Feature] llm Options
Background
I wish to experiment with other LLM models like Tongyi or Claude, but it's not feasible.
https://github.com/web-infra-dev/midscene/blob/863e5a54d0380004038b6012d4810d79a437a401/packages/midscene/src/ai-model/openai/index.ts#L94
Aspiration
Provide a solution akin to browser-use, allowing the integration of custom models.
import { OpenAI } from "@langchain/openai";
const llm = new OpenAI({
model: "gpt-3.5-turbo-instruct",
temperature: 0,
maxTokens: undefined,
timeout: undefined,
maxRetries: 2,
apiKey: process.env.OPENAI_API_KEY,
// other params...
});
const mid = new PuppeteerAgent(page,{llm});
Benefits
- less code、lower maintenance complexity
- The token cost of GPT-4 is relatively high; in certain scenarios, cheaper models can be employed to achieve similar outcomes.
Try these params: https://midscenejs.com/model-provider.html
That should work for you.