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

Model Selection Error with Direct Provider Specification #1872

Closed
nullstreak opened this issue Apr 21, 2024 · 3 comments
Closed

Model Selection Error with Direct Provider Specification #1872

nullstreak opened this issue Apr 21, 2024 · 3 comments
Assignees
Labels
bug Something isn't working stale

Comments

@nullstreak
Copy link
Contributor

Certain models throw an error when a provider is specified directly, despite functioning correctly when the same model is executed randomly via the RetryProvider.

To reproduce the issue, consider the following example:

from g4f.client import Client
import g4f

client = Client()
response = client.chat.completions.create(
    messages=[{'role':'user', 'content': 'test'}], 
    model=g4f.models.mistral_7b,
    provider=g4f.Provider.HuggingChat,
    stream=True,
)

for chunk in response:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content or "", end="")

This code snippet yields the following error:

g4f.errors.ModelNotSupportedError: Model is not supported: mistralai/Mistral-7B-Instruct-v0.1 in: HuggingChat

However, when we comment out the provider=g4f.Provider.HuggingChat line and run the code multiple times, allowing the RetryProvider to randomly select the HuggingChat provider, the model functions as expected.

@nullstreak nullstreak added the bug Something isn't working label Apr 21, 2024
@hlohaus
Copy link
Collaborator

hlohaus commented Apr 23, 2024

You can only use the models that the provider supports. If you want to run a provider with its default model, you can pass g4f.models.default.

Copy link

github-actions bot commented May 1, 2024

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

@github-actions github-actions bot added the stale label May 1, 2024
Copy link

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

3 participants