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

Adds an exception for missing templates. #1034

Merged

Conversation

phil-scott-78
Copy link
Contributor

Adds better exception handling for when there are missing templates with a model when calling llama_chat_apply_template

Funny enough, it looks like ggerganov/llama.cpp#10572 added support for my missing template, but still nice to have a better exception down the road.

Closes #1032

/// <summary>
/// `llama_decode` return a non-zero status code
/// </summary>
public class MissingTemplateError
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public class MissingTemplateError
public class MissingTemplateException

Exception classes should end with Exception (docs).

RuntimeError and LLamaDecodeError break this rule and should be fixed sometime!

LLama/LLamaTemplate.cs Outdated Show resolved Hide resolved
LLama/LLamaTemplate.cs Outdated Show resolved Hide resolved
Copy link
Member

@martindevans martindevans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor naming nit, otherwise looks good :)

@phil-scott-78 phil-scott-78 force-pushed the better-error-on-missing-prompt branch from 9136f7f to 45a8a19 Compare January 3, 2025 03:27
@phil-scott-78
Copy link
Contributor Author

i even felt a bit dirty typing it out, should have trusted my gut. Got it fixed up and pushed now.

@martindevans
Copy link
Member

Thanks again!

@martindevans martindevans merged commit 1f83d6b into SciSharp:master Jan 3, 2025
6 checks passed
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.

[BUG]: unknown templates generate exception
2 participants