Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

community: Fixes use of ImagePromptTemplate with Ollama #24140

Merged
merged 2 commits into from
Jul 11, 2024

Conversation

a7ul
Copy link
Contributor

@a7ul a7ul commented Jul 11, 2024

Description: ImagePromptTemplate for Multimodal llms like llava when using Ollama
Twitter handle: https://x.com/a7ulr

Details:

When using llava models / any ollama multimodal llms and passing images in the prompt as urls, langchain breaks with this error.

image_url_components = image_url.split(",")
                           ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'split'

From the looks of it, there was bug where the condition did check for a url field in the variable but missed to actually assign it.

This PR fixes ImagePromptTemplate for Multimodal llms like llava when using Ollama specifically.

@hwchase17

When using llava models / any ollama multimodal llms and passing images in the prompt as urls, langchain breaks with this error. 

```python
image_url_components = image_url.split(",")
                           ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'split'
```

From the looks of it, there was bug where the condition did check for a `url` field in the variable but missed to actually assign it.

This PR fixes ImagePromptTemplate for Multimodal llms like llava when using Ollama specifically.
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 11, 2024
Copy link

vercel bot commented Jul 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Jul 11, 2024 6:11pm

@dosubot dosubot bot added community Related to langchain-community 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Jul 11, 2024
@isahers1 isahers1 self-assigned this Jul 11, 2024
@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Jul 11, 2024
@isahers1 isahers1 merged commit 457677c into langchain-ai:master Jul 11, 2024
43 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature community Related to langchain-community lgtm PR looks good. Use to confirm that a PR is ready for merging. size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants