AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Nomic: `NomicEmbeddings.Embed_image` Raises A Bare `AssertionError` Unless `Vision_model` Is Set, And `Vision_model` Is Rejected By Type Checkers

NomicEmbeddings.embed_image passes self.vision_model=None unconditionally to nomic.embed.image, overriding the SDK's default 'nomic-embed-vision-v1.5'; the SDK's response model assertion then fails with an empty AssertionError. The constructor overloads also omit vision_model, causing mypy call-overload errors.

highConfidence 95%LangchainAffected V1.0.1

Origin Analysis

The optional vision_model constructor argument defaults to None and is forwarded as model=None to embed.image, even though nomic.embed.image's model parameter has a default of 'nomic-embed-vision-v1.5'. Passing None replaces that default, so the SDK asserts response['model'] == None after the service returns its own default model name. Additionally, __init__ overloads do not include vision_model, so type checkers reject the only working parameter.
Install langchain-nomic 1.0.1 with nomic 3.6.0. Instantiate NomicEmbeddings(model='nomic-embed-text-v1.5') without vision_model and call embed_image(['https://example.com/cat.jpg']). The call raises AssertionError: ''. Attempting to pass vision_model='nomic-embed-vision-v1.5' is rejected by mypy 2.1 with 'Unexpected keyword argument "vision_model" for overloaded function'.

Fixing Code Block

Edge Case Audit

This fix relies on nomic.embed.image having a default model of 'nomic-embed-vision-v1.5' in the installed nomic SDK. If an older nomic version without that default is used, omitting model may cause a different error; ensure nomic>=3.6.0 is pinned. The overload additions require keeping all __init__ overloads in sync with the actual implementation; future changes may reintroduce type-checker errors. Rollback is simple: revert to unconditionally passing model=self.vision_model, but that restores the original AssertionError.

Ecosystem Topology