Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix 'content' check on messages in chat() #118

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

DSLstandard
Copy link
Contributor

In chat() in Client and AsyncClient, if message['content'] is "",

the following would raise an error since bool("") also returns False like bool(None):

if not message.get('content'):
  raise RequestError('messages must contain content')

Doing the following would fix it:

if 'content' not in message:
  raise RequestError('messages must contain content')

As far as I know ollama does not explicitly prohibit empty content in messages.

@jmorganca jmorganca requested a review from mxyng April 15, 2024 12:49
@mxyng mxyng merged commit 5b94a8d into ollama:main Apr 25, 2024
@mxyng
Copy link
Collaborator

mxyng commented Apr 25, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants