> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-zh.cn/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",  # UK results
    "device": "mobile",  # or "desktop"
    "pages": 3  # Number of pages (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

# Initialize tools
search_tool = CloroGoogleSearch()
chatgpt_tool = CloroChatGPT()
tools = [search_tool, chatgpt_tool]

# Create agent
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)

# Run agent
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)

# Access structured results
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="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/i18n\zh-CN\oss\python\integrations\tools\cloro.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>

  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>
</div>
