Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# cloro for Dify

cloro is the API for AI answers. This plugin adds six tools from [cloro](https://cloro.dev?utm_source=dify-plugins&utm_medium=byok) to Dify agents, chatflows and workflows:
cloro is the API for AI answers. This plugin adds seven tools from [cloro](https://cloro.dev?utm_source=dify-plugins&utm_medium=byok) to Dify agents, chatflows and workflows:

- **ChatGPT Answer**: the answer that ChatGPT gives to a prompt, with the sources that it cites.
- **Google AI Mode Answer**: the answer that Google AI Mode gives to a prompt, with its sources.
- **Gemini Answer**: the answer that Gemini gives to a prompt, with its sources.
- **Bing AI Mode Answer**: the answer that Bing AI Mode gives to a prompt, with its sources.
- **Meta AI Answer**: the answer that Meta AI gives to a prompt, with its sources.
- **Google Search**: the Google organic results and ads for a query. As an option, the tool also gets the Google AI Overview text and its sources.
- **Bing Search**: the Bing organic results and ads for a query. As an option, the tool also gets the text of the Bing AI Overview (the AI summary at the top of the results page) and its sources.

Expand All @@ -29,11 +30,13 @@ Contact: info@cloro.dev
| Google AI Mode Answer | Prompt, Country | 6 |
| Gemini Answer | Prompt, Country | 6 |
| Bing AI Mode Answer | Prompt, Country | 6 |
| Meta AI Answer | Prompt, Country | 6 |
| Google Search | Query, Country, Include AI Overview | 5, or 7 with the AI Overview |
| Bing Search | Query, Country, Include AI Overview | 5, or 7 with the AI Overview |

- **Prompt** of the Bing AI Mode tool and **Query** of the Bing Search tool can have a maximum of 3,500 characters after URL encoding, and fewer for non-Latin scripts. cloro rejects a longer text with error 400.
- **Country** is a two-letter country code, for example `US`, `GB` or `DE`. The default is `US`. The Bing tools do not support `CN`, `KR` and `RU`.
- **Country** is a two-letter country code, for example `US`, `GB` or `DE`. The default is `US`. The Bing tools do not support `CN`, `KR` and `RU`. The Meta AI tool does not support `CN` and `RU`.
- Meta AI gives no answer to some "best X" product prompts. The Meta AI tool then stops with a cloro error, and a retry does not help.
- **Include AI Overview** is a setting of the Google Search and Bing Search tools. Google and Bing do not show an AI Overview for all queries. When there is no AI Overview, the AI Overview text is empty.

The credit counts are for the synchronous API, which these tools use. Source: [cloro pricing by provider](https://cloro.dev/docs/guides/providers?utm_source=dify-plugins&utm_medium=byok).
Expand Down
8 changes: 4 additions & 4 deletions cloro_api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Calls to the cloro API and conversion of its responses to tool output.

The provider and the six tools share this module. A tool file must hold
The provider and the seven tools share this module. A tool file must hold
only one Tool subclass, so the shared code is here and not in tools/.
"""

Expand All @@ -9,7 +9,7 @@
import requests

API_BASE = "https://api.cloro.dev"
USER_AGENT = "cloro-dify-plugin/0.1.2"
USER_AGENT = "cloro-dify-plugin/0.2.0"

# Seconds to wait for cloro. A sync AI answer can take some minutes, so the
# answer timeout is near the plugin limit (MAX_REQUEST_TIMEOUT in main.py).
Expand Down Expand Up @@ -138,7 +138,7 @@ def answer_sources(result: dict) -> list[dict]:


def answer_output(result: dict) -> dict:
"""Output of the ChatGPT, Google AI Mode, Gemini and Bing AI Mode tools."""
"""Output of the ChatGPT, Google AI Mode, Gemini, Bing AI Mode and Meta AI tools."""
return {
"text": result.get("text") or "",
"markdown": result.get("markdown") or "",
Expand Down Expand Up @@ -192,7 +192,7 @@ def search_output(result: dict) -> dict:


def ask(api_key: Any, engine: str, params: dict) -> dict:
"""Send a prompt to chatgpt, aimode, gemini or bing/aimode. Return the tool's JSON output."""
"""Send a prompt to chatgpt, aimode, gemini, bing/aimode or meta-ai. Return the tool's JSON output."""
prompt = required_text(params, "prompt", "Prompt")
country = country_code(params)
body = {"prompt": prompt, "country": country, "include": {"markdown": True}}
Expand Down
4 changes: 2 additions & 2 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: 0.1.2
version: 0.2.0
type: plugin
author: cloro-dev
name: cloro
label:
en_US: cloro
description:
en_US: cloro is the API for AI answers. Get the answers of ChatGPT, Google AI Mode, Gemini and Bing AI Mode (Copilot Search in Bing) with their sources, and Google Search and Bing Search results with the AI Overview.
en_US: cloro is the API for AI answers. Get the answers of ChatGPT, Google AI Mode, Gemini, Bing AI Mode (Copilot Search in Bing) and Meta AI with their sources, and Google Search and Bing Search results with the AI Overview.
icon: icon.svg
created_at: "2026-11-06T00:00:00Z"
privacy: PRIVACY.md
Expand Down
3 changes: 2 additions & 1 deletion provider/cloro.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ identity:
label:
en_US: cloro
description:
en_US: cloro is the API for AI answers. Get the answers of ChatGPT, Google AI Mode, Gemini and Bing AI Mode (Copilot Search in Bing) with their sources, and Google Search and Bing Search results with the AI Overview.
en_US: cloro is the API for AI answers. Get the answers of ChatGPT, Google AI Mode, Gemini, Bing AI Mode (Copilot Search in Bing) and Meta AI with their sources, and Google Search and Bing Search results with the AI Overview.
icon: icon.svg
tags:
- search
Expand All @@ -26,6 +26,7 @@ tools:
- tools/aimode.yaml
- tools/gemini.yaml
- tools/bing_aimode.yaml
- tools/meta_ai.yaml
extra:
python:
source: provider/cloro.py
47 changes: 47 additions & 0 deletions tests/fixtures/meta-ai.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"success": true,
"result": {
"text": "Short answer: HubSpot.\nHubSpot leads by customer count in the SMB segment, even though Salesforce leads the overall CRM market by revenue.",
"sources": [
{
"position": 1,
"label": "Best CRM for Agencies 2026 - Client Management Compared",
"url": "https://leadspark.questo.media/articles/best-crm-for-agencies-2026"
},
{
"position": 2,
"label": "Best CRM for Marketing and Creative Agencies",
"url": "https://software.firstreviewers.com/best-crm-agencies/"
},
{
"position": 3,
"label": "HubSpot Market Share 2026: CRM Share, Revenue & Customers | Resonate Blog",
"url": "https://www.resonatehq.com/blog/hubspot-market-share"
}
],
"citationPills": [
{
"position": 3,
"label": "HubSpot Market Share 2026: CRM Share, Revenue & Customers | Resonate Blog",
"url": "https://www.resonatehq.com/blog/hubspot-market-share",
"domain": "resonatehq.com",
"citationPillId": 1
},
{
"position": 1,
"label": "Best CRM for Agencies 2026 - Client Management Compared",
"url": "https://leadspark.questo.media/articles/best-crm-for-agencies-2026",
"domain": "leadspark.questo.media",
"citationPillId": 1
},
{
"position": 2,
"label": "Best CRM for Marketing and Creative Agencies",
"url": "https://software.firstreviewers.com/best-crm-agencies/",
"domain": "software.firstreviewers.com",
"citationPillId": 2
}
],
"markdown": "Short answer: **HubSpot**.\n\nHubSpot leads by customer count in the SMB segment, even though Salesforce leads the overall CRM market by revenue.\n\n### The usual top 4 for small agencies\n\n- **HubSpot**: Best default."
}
}
4 changes: 3 additions & 1 deletion tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from tools.chatgpt import CloroChatGPTTool
from tools.gemini import CloroGeminiTool
from tools.google_search import CloroGoogleSearchTool
from tools.meta_ai import CloroMetaAITool

KEY = "test-key-not-real"

Expand Down Expand Up @@ -73,6 +74,7 @@ def test_network_error_has_a_clear_message(http):
(CloroAIModeTool, "aimode"),
(CloroGeminiTool, "gemini"),
(CloroBingAIModeTool, "bing/aimode"),
(CloroMetaAITool, "meta-ai"),
],
)
def test_answer_tools_return_text_and_sources(http, tool_cls, engine):
Expand Down Expand Up @@ -356,7 +358,7 @@ def test_manifest_and_tool_files_agree():


def test_no_promoted_engines_outside_scope():
# Only ChatGPT, Google AI Mode, Gemini, Bing AI Mode, Google Search and Bing Search are in this plugin.
# Only ChatGPT, Google AI Mode, Gemini, Bing AI Mode, Meta AI, Google Search and Bing Search are in this plugin.
# "Copilot Search in Bing" is the other name of Bing AI Mode, so it is allowed.
names = ("perplexity", "copilot", "grok")
for path in ROOT.rglob("*"):
Expand Down
14 changes: 14 additions & 0 deletions tools/meta_ai.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from collections.abc import Generator
from typing import Any

from dify_plugin import Tool
from dify_plugin.entities.tool import ToolInvokeMessage

from cloro_api import answer_text, ask


class CloroMetaAITool(Tool):
def _invoke(self, tool_parameters: dict[str, Any]) -> Generator[ToolInvokeMessage, None, None]:
output = ask(self.runtime.credentials.get("api_key"), "meta-ai", tool_parameters)
yield self.create_text_message(answer_text(output))
yield self.create_json_message(output)
32 changes: 32 additions & 0 deletions tools/meta_ai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
identity:
name: meta_ai
author: cloro-dev
label:
en_US: Meta AI Answer
description:
human:
en_US: Send a prompt to Meta AI from a country and get the answer with its sources. Costs 6 credits.
llm: Sends a prompt to Meta AI from a country and returns the answer that Meta AI gives, with the sources it cites. Use it to see what Meta AI tells people about a topic, a brand or a product.
parameters:
- name: prompt
type: string
required: true
label:
en_US: Prompt
human_description:
en_US: The prompt to send to Meta AI. The maximum is 10,000 characters.
llm_description: The question or prompt to send to Meta AI.
form: llm
- name: country
type: string
required: false
default: US
label:
en_US: Country
human_description:
en_US: Two-letter country code to send the prompt from, for example US, GB or DE. The default is US. CN and RU are not available.
llm_description: Optional two-letter ISO 3166-1 country code to send the prompt from, for example US, GB or DE. The default is US.
form: llm
extra:
python:
source: tools/meta_ai.py