Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计通过

cohere-apicohere API 搜索

Agent Skill

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

总安装

423

周安装

18

GitHub Stars

4

下载量

148
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cohere-api(cohere API 搜索)
来源仓库:https://github.com/alphaonedev/openclaw-graph
仓库路径:skills/cohere-api
安装命令:
npx skills add https://github.com/alphaonedev/openclaw-graph --skill cohere-api
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/alphaonedev/openclaw-graph --skill cohere-api

简介

cohere-api 集成 Cohere 语言模型 API,支持嵌入生成、语义搜索与 RAG 增强问答。

  • 适用于文本向量化、搜索结果重排或大文本集语义分析等 AI 工作流。
  • 通过 npx 命令安装,依赖真实 API 密钥并产生外部调用费用。
  • 使用时需注意鉴权方式、调用频率限制及支付模式设置。
  • cohere-api 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

cohere-api

Purpose

This skill integrates the Cohere API to handle AI tasks like generating embeddings, implementing Retrieval-Augmented Generation (RAG), reranking results, and performing semantic search. It's designed for enhancing AI workflows with Cohere's language models, using real-time API calls for efficient processing.

When to Use

Use this skill when processing text for vector embeddings in ML pipelines, building RAG systems for accurate query responses, reranking search results for relevance, or conducting semantic searches on large datasets. Apply it in scenarios requiring API-based AI enhancements, such as chatbots needing contextual retrieval or applications analyzing text similarity.

Key Capabilities

  • Generate embeddings: Convert text to vectors via the /embed endpoint, supporting models like "embed-english-v3.0" for up to 512 tokens per request.
  • RAG implementation: Fetch and augment responses using /generate with external data sources, handling up to 2048 tokens for input and output.
  • Reranking: Use the /rerank endpoint to score and reorder lists of texts based on query relevance, with options for top-k results.
  • Semantic search: Leverage embeddings for similarity searches, integrating with vector databases like Pinecone or Weaviate.
  • Rate limiting: API enforces 60 requests per minute; monitor usage via response headers.
  • Model selection: Specify models in requests, e.g., "command" for generation or "embed-multilingual-v2.0" for cross-language embeddings.

Usage Patterns

To use this skill, first set the environment variable for authentication: export COHERE_API_KEY=your_api_key. Then, make API calls via HTTP requests or the Cohere SDK. For embeddings, structure requests with JSON payloads containing text arrays. In RAG patterns, retrieve documents first, then pass them to /generate for context-aware responses. Always handle asynchronous patterns by checking response status codes. For reranking, pipe search results through the endpoint in a single call. Use try-except blocks in code to wrap API interactions for reliability.

Common Commands/API

Interact with Cohere API endpoints using curl or Python SDK. Authentication requires the Bearer token from $COHERE_API_KEY.

  • Embeddings endpoint: POST https://api.cohere.ai/v1/embed Example: curl -X POST https://api.cohere.ai/v1/embed -H "Authorization: Bearer $COHERE_API_KEY" -H "Content-Type: application/json" -d '{"texts": ["Hello world"], "model": "embed-english-v3.0"}'
  • Generate endpoint (for RAG): POST https://api.cohere.ai/v1/generate Code snippet: import cohere; import os client = cohere.Client(api_key=os.environ['COHERE_API_KEY']) response = client.generate(model='command', prompt='Explain AI', max_tokens=50)
  • Rerank endpoint: POST https://api.cohere.ai/v1/rerank Example: curl -X POST https://api.cohere.ai/v1/rerank -H "Authorization: Bearer $COHERE_API_KEY" -d '{"query": "best AI tools", "documents": ["OpenClaw is great", "Cohere is useful"], "top_n": 1}'
  • Semantic search pattern: First generate embeddings, then compute cosine similarity in code. Code snippet: import numpy as np emb1 = response.body['embeddings'][0] # From embed response emb2 = [0.1, 0.2,...] # Another embedding similarity = np.dot(emb1, emb2) / (np.linalg.norm(emb1) * np.linalg.norm(emb2))

Config formats: All requests use JSON; for SDK, pass dictionaries like {"model": "command", "prompt": "text"}.

Integration Notes

Integrate by importing the Cohere SDK in your Python environment: pip install cohere. Set $COHERE_API_KEY as an environment variable for secure handling. In OpenClaw workflows, invoke this skill via function calls, e.g., using the skill ID "cohere-api" in agent prompts. For multi-step integrations, chain outputs: use embeddings from one call as input for RAG. Monitor API usage with Cohere's dashboard to avoid rate limits. Ensure HTTPS for all requests and handle regional endpoints if needed (e.g., us.cohere.ai).

Error Handling

Common errors include 401 Unauthorized (missing or invalid API key), 429 Too Many Requests (rate limit exceeded), and 400 Bad Request (invalid JSON or parameters). To handle: Check response.status_code in code and retry with exponential backoff for 429 errors. For 401, verify $COHERE_API_KEY and log the issue. Use try-except blocks like this: Code snippet: try: response = client.embed(texts=["text"]) except cohere.CohereError as e: if e.http_status == 429: time.sleep(60) # Wait and retry else: raise Always validate inputs before API calls to prevent 400 errors, e.g., ensure text length is under 512 tokens.

Concrete Usage Examples

Example 1: Generating Embeddings for Semantic Search To create embeddings for a query and compare with documents: First, set up: export COHERE_API_KEY=your_key Then, run: import cohere; import os client = cohere.Client(api_key=os.environ['COHERE_API_KEY']) emb_response = client.embed(texts=["What is AI?"]) query_emb = emb_response.body['embeddings'][0]

Use query_emb for similarity search in a vector DB

Example 2: Implementing RAG for Question Answering For RAG, retrieve context and generate a response: Prepare documents array, e.g., docs = ["AI is machine intelligence."] Code: response = client.generate(model='command', prompt='What is AI? Context: ' + ' '.join(docs), max_tokens=100) print(response.body['generations'][0]['text']) # Output the generated answer

Graph Relationships

  • Related to cluster: ai-apis (e.g., shares dependencies with other API-based skills like openai-api).
  • Connected via tags: ai-apis, api (links to skills in similar categories for combined workflows).
  • Outgoing: Provides inputs to skills like vector-stores for embedding-based searches.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.54%
按下载量换算53

Claude

29.42%
按下载量换算44

Cursor

19.07%
按下载量换算28

Gemini CLI

9.25%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills