Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR focuses on addressing two open issues by introducing a custom system role:
Initially, there are no apparent issues with either
litellm
or Groq. However, this flexible approach will address both concerns.snippet.py
The code was initially intended to function with a hardcoded system role. However, some LLMs require customization. This PR introduces a new
custom_role
parameter to address the above issues. Then, usingcustom_role=user
should solve these issues.Below are some notes and snippets to help refresh my memory whenever I revisit this code. They also provide newcomers with an overview of the underlying processes:
additional notes and snippets
The
py-zerox
library is designed to interact with LLMs via API, using thelitellm
library to ensure everything runs smoothly. Before jumping into action,py-zerox
performs a couple of important checks usinglitellm
methods:model validation
The
validate_model(self)
method useslitellm.supports_vision(model=self.model)
to confirm that the model is indeed a vision model. Essentially,litellm
checks a comprehensive JSON map with detailed information on various LLM options to ensure compatibility.snippets
access validation
The
validate_access(self)
method useslitellm.check_valid_key(model=self.model, api_key=None)
to verify access to the model. This check ensures that environment variables are correctly set with proper values.In short,
litellm
performs a simple API request to the given LLM. If any issues arise, it simply returnsFalse
. Otherwise, it returns aTrue
for a successful outcome.snippets
Once these checks are completed,
py-zerox
begins using thelitellm
to convert PDFs into markdown format.Thanks!