Add image embedding to the Cohere vectorizer (Embed v4 and v5)
维护者通常 4 天内回复
@rahulsjha 已经在做这个了。
开始于 2026年12月3日。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 58/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
Start with redisvl/utils/vectorize/text/cohere.py, the vectorizer_from_dict mapping, and the existing VoyageAI deprecated alias pattern. Check the v2 Cohere client version and the v4 request shape, then add sync and async coverage for text, image, and supported multimodal inputs. Done means the stated unit and API tests pass and the API reference and vectorizers guide describe the new behavior.
由索引模型根据 Issue 内容生成。
描述
Summary
Add image input for Cohere Embed v4.0 and v5. Follow the pattern from #452: a new CohereVectorizer that takes text and images, with CohereTextVectorizer kept as a deprecated alias. Once #885 merges, also accept MultimodalInput, since Cohere merges text and image parts in one input into one vector.
Depends on #885 for the MultimodalInput part.
Current state
CohereTextVectorizer(redisvl/utils/vectorize/text/cohere.py) uses the v1cohere.Clientand callsembed(texts=...). It is text-only.vectorizer_from_dictmapsVectorizers.coheretoCohereTextVectorizer.- The extra pins
cohere>=4.44.
Provider facts (Cohere docs, 2026-12-02)
embed(inputs=[{"content": [parts...]}], model=..., input_type=..., embedding_types=[...], output_dimension=...). Each part is either{"type": "text", "text": ...}or{"type": "image_url", "image_url": {"url": <base64 data URL>}}. Each entry ininputsgives one vector.- The docs show this request shape for
embed-v5.0-pro. Forembed-v4.0they list "mixed texts/images" as a supported modality but give no request example, so check v4.0 during implementation. input_typemust besearch_query,search_document,classificationorclustering.- Images: PNG, JPEG, WEBP or GIF, with a 20 MB payload cap. Cohere resizes images that are too large or too small.
- Dimensions:
embed-v4.0: 256, 512, 1024, or 1536 (default);embed-v5.0-pro/-fast: 256 up to 2048, with 2048 the default.
Design
- New class:
CohereVectorizerinredisvl/utils/vectorize/cohere.py. It uses the v2 client (ClientV2/AsyncClientV2) and theinputs=request shape for every item, text included, so there is one code path.CohereTextVectorizerbecomes a@deprecated_classsubclass, asVoyageAITextVectorizerdid.vectorizer_from_dictmapsVectorizers.cohereto the new class.- Raise the
coherefloor to the first release withClientV2. Check which version that is.
- Accepted items:
str,PIL.Image.Image, andPathto an image, encoded as a base64 data URL. Add anembed_image(path)helper. - Model capability: image and
MultimodalInputitems requireembed-v4.0or anembed-v5.0-*model. Older models raiseTypeErrorbefore the API call. v3 image embedding goes through a different parameter and is out of scope. - Dimensions: add an
output_dimensionconstructor argument. It setsdimsand is fixed for the vectorizer's lifetime, likeGoogleGenAIVectorizer.output_dimensionality. - Unchanged behaviour:
input_typestays required, anddtypestill maps toembedding_types. - Interleaved input (with #885): a
MultimodalInputbecomes oneinputsentry with one part per element.
Out of scope
- Image input on v3 models.
- PDF input.
Definition of done
- Text and image embedding work on
embed-v4.0andembed-v5.0-*, sync and async, as single items and insideembed_many. CohereTextVectorizerstill works and warns. Existing text results are unchanged for the same model andinput_type.- After #885,
MultimodalInputreturns one vector on the supported models. - Unit tests: the request shape sent to a mocked v2 client, rejection by model capability, and the deprecated alias.
- Integration tests marked as API tests.
- Docs: the API reference and the vectorizers guide.
References
- 主要语言
- Python
- 星标
- 435
- 派生
- 123
- 平均合并
- 8 天 1 小时
- 30 天内合并 PR
- 39
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
redis/redis-vl-python 的其他 Issue
-
SearchIndex.drop_keys does not validate cluster hash-tag co-location (inconsistent with drop_documents)可能已有人在做 @Hashim1999164 于 47 天前认领。 未关闭bug good first issue index
难度 2/5 1-3 小时 新手友好度 78/100
redis/redis-vl-python#601 · 2 条评论 ·
维护者通常 4 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
redis/redis-vl-python#889 ·
维护者通常 4 天内回复
-
难度 5/5 一周以上 新手友好度 38/100
redis/redis-vl-python#887 ·
维护者通常 4 天内回复
-
GoogleGenAIVectorizer.embed_many fails on gemini-embedding-2 for batches of more than one input可能已有人在做 @pcbeingused33 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 25/100
redis/redis-vl-python#886 ·
维护者通常 4 天内回复
-
难度 4/5 3-5 天 新手友好度 52/100
redis/redis-vl-python#885 ·
维护者通常 4 天内回复
查看 redis/redis-vl-python 的全部 Issue
相似的 Issue
-
resource-submission validation-passed
难度 1/5 1 小时以内 新手友好度 68/100
hesreallyhim/awesome-claude-code#3875 · 1 条评论 ·
-
bug
难度 2/5 1-3 小时 新手友好度 77/100
bvis/aegis-hass#725 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stamp未关闭
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.x可能已有人在做 @NimaVaziri 今天认领。 未关闭Pytorch
难度 2/5 1-3 小时 新手友好度 78/100
NVIDIA/TensorRT-LLM#23406 ·
维护者通常 1 天内回复