Scrap Web
  • Get Started
    • Introduction
    • Quickstart
  • Customize
    • Agent Settings
    • Browser Settings
    • Custom Functions
    • LangChain Chat Models
    • System prompt
  • Development
    • Local Setup
    • Telemetry
    • Roadmap
    • Tokenomics
Powered by GitBook
On this page
  1. Customize

LangChain Chat Models

PreviousCustom FunctionsNextSystem prompt

Last updated 4 months ago

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 .

Model Recommendations

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

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

Supported Models

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

OpenAI

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

OPENAI_API_KEY=

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

Copy

from langchain_anthropic import ChatAnthropic
from swift_web import Agent

# Initialize the model
llm = ChatAnthropic(
    model_name="claude-3-sonnet-20240229",
    temperature=0.0,
    timeout=100, # Increase for complex tasks
)

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

And add the variable:

.envCopy

ANTHROPIC_API_KEY=

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

Copy

from langchain_openai import AzureChatOpenAI
from swift_web import Agent
from pydantic import SecretStr
import os

# Initialize the model
llm = AzureChatOpenAI(
    model="gpt-4o",
    api_version='2024-10-21',
    azure_endpoint=os.getenv('AZURE_OPENAI_ENDPOINT', ''),
    api_key=SecretStr(os.getenv('AZURE_OPENAI_KEY', '')),
)

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

Required environment variables:

.envCopy

AZURE_OPENAI_ENDPOINT=https://your-endpoint.openai.azure.com/
AZURE_OPENAI_KEY=

(Sorry, we are working on it)

  • Gemini

  • Groq

  • DeepSeek

  • Github

  • Ollama

  • QWen

Anthropic

Azure OpenAI

Coming soon

LangChain documentation
​
WebVoyager Dataset
​
​
​
​
​