user-robotLangChain Chat Models

Overview

Scrap Web supports various LangChain chat models. Here’s how to configure and use the most popular ones. The full list is available in the LangChain documentationarrow-up-right.

arrow-up-rightModel Recommendations

We have yet to test performance across all models. Currently, we recommend using GPT-4o. It achieves 89% accuracy on WebVoyager Datasetarrow-up-right.

circle-info

All models require their respective API keys. Make sure to set them in your environment variables before running the agent.

arrow-up-rightSupported Models

All LangChain chat models are supported. We will document the most popular ones here.

arrow-up-rightOpenAI

OpenAI’s GPT-4o models are recommended for best performance.

Copy

from langchain_openai import ChatOpenAI
from swift_web import Agent

# Initialize the model
llm = ChatOpenAI(
    model="gpt-4o",
    temperature=0.0,
)

# Create agent with the model
agent = Agent(
    task="Your task here",
    llm=llm
)

Required environment variables:

.envCopy

arrow-up-rightAnthropic

Claude models provide excellent performance and can handle complex tasks well.

Copy

And add the variable:

.envCopy

arrow-up-rightAzure OpenAI

If you’re using Azure OpenAI services, you can configure the model like this:

Copy

Required environment variables:

.envCopy

(Sorry, we are working on it)

  • Gemini

  • Groq

  • DeepSeek

  • Github

  • Ollama

  • QWen

Last updated