> ## Documentation Index
> Fetch the complete documentation index at: https://cndoc-langchain.site/llms.txt
> Use this file to discover all available pages before exploring further.

# cloro

[cloro](https://cloro.dev) 提供用于监控 AI 平台和搜索引擎的工具，并支持结构化数据提取。

## 设置

安装 `langchain-cloro` 包：

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pip install -U langchain-cloro
```

从 [cloro 控制面板](https://dashboard.cloro.dev) 获取您的 API 密钥，并将其设置为环境变量：

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import os
os.environ["CLORO_API_KEY"] = "your-api-key"
```

## Google 搜索抓取器

从 Google 搜索结果中提取结构化数据，包括自然搜索结果、“人们还问”问题、相关搜索以及可选的 AI 概览。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_cloro import CloroGoogleSearch

tool = CloroGoogleSearch()
result = tool.invoke({"query": "best laptops for programming"})
```

### 包含 AI 概览

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
result = tool.invoke({
    "query": "best laptops for programming",
    "include_aioverview": True,
    "aioverview_markdown": True
})
```

### 自定义参数

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
result = tool.invoke({
    "query": "python tutorials",
    "country": "GB",  # 英国结果
    "device": "mobile",  # 或 "desktop"
    "pages": 3  # 页数 (1-20)
})
```

## ChatGPT 抓取器

从 ChatGPT 中提取结构化数据，包含购物卡片、实体提取以及用于监控产品、价格和品牌提及的高级功能。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_cloro import CloroChatGPT

tool = CloroChatGPT()
result = tool.invoke({"prompt": "What are the best sneakers under $100?"})
```

### 包含原始响应和搜索查询

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
result = tool.invoke({
    "prompt": "best running shoes 2024",
    "include_raw_response": True,
    "include_search_queries": True,
    "country": "US"
})
```

## Gemini 抓取器

从 Google 的 Gemini AI 中提取结构化数据，包含来源引用和置信度级别。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_cloro import CloroGemini

tool = CloroGemini()
result = tool.invoke({"prompt": "Explain quantum entanglement"})
```

### 包含 Markdown 响应

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
result = tool.invoke({
    "prompt": "What is machine learning?",
    "include_markdown": True,
    "country": "US"
})
```

## Perplexity 抓取器

从 Perplexity AI 中提取全面的结构化数据，包含实时网络来源、购物产品、媒体内容和旅行信息。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_cloro import CloroPerplexity

tool = CloroPerplexity()
result = tool.invoke({"prompt": "Best hotels in San Francisco"})
```

## Grok 抓取器

从 Grok 中提取全面的结构化数据，包含实时网络来源和增强的来源元数据，如预览文本、创建者详情和图片。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_cloro import CloroGrok

tool = CloroGrok()
result = tool.invoke({"prompt": "Latest news about AI"})
```

## Copilot 抓取器

从 Microsoft Copilot 中提取结构化数据，包含来源引用。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_cloro import CloroCopilot

tool = CloroCopilot()
result = tool.invoke({"prompt": "What is the capital of France?"})
```

## 与代理一起使用

所有 cloro 工具均可与 LangChain 代理一起使用：

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_core.prompts import ChatPromptTemplate
from langchain_openai import ChatOpenAI
from langchain_cloro import CloroGoogleSearch, CloroChatGPT

# 初始化工具
search_tool = CloroGoogleSearch()
chatgpt_tool = CloroChatGPT()
tools = [search_tool, chatgpt_tool]

# 创建代理
llm = ChatOpenAI(model="gpt-4", temperature=0)
prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a helpful assistant"),
    ("human", "{input}"),
    ("placeholder", "{agent_scratchpad}"),
])
agent = create_tool_calling_agent(llm, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)

# 运行代理
result = agent_executor.invoke({"input": "Search for information about AI trends and summarize what you find"})
```

## 响应格式

所有 cloro 工具返回 JSON 格式的响应，包含结构化数据：

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import json

result = tool.invoke({"query": "python programming"})
data = json.loads(result)

# 访问结构化结果
if "result" in data:
    if "organicResults" in data["result"]:
        for item in data["result"]["organicResults"]:
            print(f"{item['title']}: {item['link']}")
```

## API 参考

* **`CloroGoogleSearch`**：支持 AI 概览的 Google 搜索
* **`CloroChatGPT`**：带购物卡片的 ChatGPT 监控
* **`CloroGemini`**：带引用的 Google Gemini AI
* **`CloroPerplexity`**：带来源和媒体的 Perplexity AI
* **`CloroGrok`**：带增强元数据的 Grok
* **`CloroCopilot`**：Microsoft Copilot 监控

更多详情，请访问 [cloro 文档](https://docs.cloro.dev)。

***

<div className="source-links">
  <Callout icon="terminal-2">
    [连接这些文档](/use-these-docs) 到 Claude、VSCode 等，通过 MCP 获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在 GitHub 上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/oss/python/integrations/tools/cloro.mdx) 或 [提交问题](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
