-
-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
Updating provider documentation and small fixes in providers #2469
Changes from all commits
a49b116
fb5f478
d2838f9
834262c
3057789
cd35b8f
d005c8f
d7b4d5c
0b3284a
64714ba
59a1e76
f320020
5c38752
7454a4b
3f2c717
dccb909
47356cb
e743d68
e706b1c
fafafec
f9b685b
1123f55
a423b8c
a8b19db
1e83d07
c91b24e
2e92494
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,4 +66,3 @@ bench.py | |
to-reverse.txt | ||
g4f/Provider/OpenaiChat2.py | ||
generated_images/ | ||
g4f/Provider/.cache |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,12 +98,12 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin): | |
models = list(dict.fromkeys([default_model, *userSelectedModel, *list(agentMode.keys()), *list(trendingAgentMode.keys())])) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The line models = list(set([default_model, *userSelectedModel, *agentMode.keys(), *trendingAgentMode.keys()])) |
||
|
||
model_aliases = { | ||
"gpt-4": "blackboxai", | ||
### chat ### | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment |
||
"gpt-4": "gpt-4o", | ||
"gpt-4o-mini": "gpt-4o", | ||
"gpt-3.5-turbo": "blackboxai", | ||
"gemini-flash": "gemini-1.5-flash", | ||
"claude-3.5-sonnet": "claude-sonnet-3.5", | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment |
||
### image ### | ||
"flux": "ImageGeneration", | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ def __init__(self, model: str): | |
self.model = model | ||
|
||
class DDG(AsyncGeneratorProvider, ProviderModelMixin): | ||
label = "DuckDuckGo AI Chat" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The label should be concise and not include 'AI Chat' as it may not accurately represent the provider's functionality. |
||
url = "https://duckduckgo.com/aichat" | ||
api_endpoint = "https://duckduckgo.com/duckchat/v1/chat" | ||
working = True | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
class DeepInfraChat(AsyncGeneratorProvider, ProviderModelMixin): | ||
url = "https://deepinfra.com/chat" | ||
api_endpoint = "https://api.deepinfra.com/v1/openai/chat/completions" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the extra blank line to maintain code consistency. |
||
working = True | ||
supports_stream = True | ||
supports_system_message = True | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,13 +8,14 @@ | |
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin | ||
|
||
class Flux(AsyncGeneratorProvider, ProviderModelMixin): | ||
label = "Flux Provider" | ||
label = "HuggingSpace (black-forest-labs-flux-1-dev)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The label should be concise and relevant to the provider's functionality. Consider simplifying it to just 'Flux Provider' or a similar variant that accurately reflects its purpose. |
||
url = "https://black-forest-labs-flux-1-dev.hf.space" | ||
api_endpoint = "/gradio_api/call/infer" | ||
working = True | ||
default_model = 'flux-dev' | ||
models = [default_model] | ||
image_models = [default_model] | ||
model_aliases = {"flux-dev": "flux-1-dev"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that the model aliases are clearly defined and relevant. If 'flux-dev' is not a widely recognized alias, consider revising or providing additional context for its use. |
||
|
||
@classmethod | ||
async def create_async_generator( | ||
|
@@ -55,4 +56,4 @@ async def create_async_generator( | |
yield ImagePreview(url, prompt) | ||
else: | ||
yield ImageResponse(url, prompt) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of 'break' here may lead to unexpected behavior in the generator. Review the logic to ensure that breaking out of the loop is the intended action. |
||
break | ||
break |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,14 +10,14 @@ | |
class GizAI(AsyncGeneratorProvider, ProviderModelMixin): | ||
url = "https://app.giz.ai/assistant" | ||
api_endpoint = "https://app.giz.ai/api/data/users/inferenceServer.infer" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the unnecessary blank line. |
||
working = True | ||
supports_stream = False | ||
supports_system_message = True | ||
supports_message_history = True | ||
|
||
default_model = 'chat-gemini-flash' | ||
models = [default_model] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using a more descriptive name for 'default_model' to enhance clarity. |
||
|
||
model_aliases = {"gemini-flash": "chat-gemini-flash",} | ||
|
||
@classmethod | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,9 +143,9 @@ class Liaobots(AsyncGeneratorProvider, ProviderModelMixin): | |
working = True | ||
supports_message_history = True | ||
supports_system_message = True | ||
|
||
default_model = "gpt-4o-2024-08-06" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The model name |
||
models = list(models.keys()) | ||
|
||
model_aliases = { | ||
"gpt-4o-mini": "gpt-4o-mini-free", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The key |
||
"gpt-4o": "gpt-4o-2024-08-06", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ class RubiksAI(AsyncGeneratorProvider, ProviderModelMixin): | |
label = "Rubiks AI" | ||
url = "https://rubiks.ai" | ||
api_endpoint = "https://rubiks.ai/search/api/" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the unnecessary blank line. |
||
working = True | ||
supports_stream = True | ||
supports_system_message = True | ||
|
@@ -127,4 +128,4 @@ async def create_async_generator( | |
yield content | ||
|
||
if web_search and sources: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that the logic for yielding |
||
yield Sources(sources) | ||
yield Sources(sources) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,25 +22,21 @@ | |
from .DarkAI import DarkAI | ||
from .DDG import DDG | ||
from .DeepInfraChat import DeepInfraChat | ||
from .Flux import Flux | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The import statement for |
||
from .Free2GPT import Free2GPT | ||
from .FreeGpt import FreeGpt | ||
from .GizAI import GizAI | ||
from .Liaobots import Liaobots | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The import statement for |
||
from .MagickPen import MagickPen | ||
from .Mhystical import Mhystical | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The import statement for |
||
from .PerplexityLabs import PerplexityLabs | ||
from .Pi import Pi | ||
from .Pizzagpt import Pizzagpt | ||
from .PollinationsAI import PollinationsAI | ||
from .Prodia import Prodia | ||
from .Reka import Reka | ||
from .ReplicateHome import ReplicateHome | ||
from .RobocodersAPI import RobocodersAPI | ||
from .RubiksAI import RubiksAI | ||
from .TeachAnything import TeachAnything | ||
from .Upstage import Upstage | ||
from .You import You | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The import statement for |
||
from .Mhystical import Mhystical | ||
from .Flux import Flux | ||
|
||
import sys | ||
|
||
|
@@ -61,4 +57,4 @@ | |
]) | ||
|
||
class ProviderUtils: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The type hint for |
||
convert: dict[str, ProviderType] = __map__ | ||
convert: dict[str, ProviderType] = __map__ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,14 +51,22 @@ | |
} | ||
|
||
class Gemini(AsyncGeneratorProvider, ProviderModelMixin): | ||
label = "Google Gemini" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The label 'Google Gemini' should be consistent with the naming conventions used in the rest of the codebase. Consider using a more generic label if applicable. |
||
url = "https://gemini.google.com" | ||
|
||
needs_auth = True | ||
working = True | ||
|
||
default_model = 'gemini' | ||
image_models = ["gemini"] | ||
default_vision_model = "gemini" | ||
models = ["gemini", "gemini-1.5-flash", "gemini-1.5-pro"] | ||
model_aliases = { | ||
"gemini-flash": "gemini-1.5-flash", | ||
"gemini-pro": "gemini-1.5-pro", | ||
} | ||
synthesize_content_type = "audio/vnd.wav" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The content type 'audio/vnd.wav' may not be appropriate if the provider supports multiple content types. Ensure that this is the intended type for all use cases. |
||
|
||
_cookies: Cookies = None | ||
_snlm0e: str = None | ||
_sid: str = None | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,20 @@ | |
from ..helper import get_connector | ||
|
||
class GeminiPro(AsyncGeneratorProvider, ProviderModelMixin): | ||
label = "Gemini API" | ||
label = "Google Gemini API" | ||
url = "https://ai.google.dev" | ||
|
||
working = True | ||
supports_message_history = True | ||
needs_auth = True | ||
|
||
default_model = "gemini-1.5-pro" | ||
default_vision_model = default_model | ||
models = [default_model, "gemini-pro", "gemini-1.5-flash", "gemini-1.5-flash-8b"] | ||
model_aliases = { | ||
"gemini-flash": "gemini-1.5-flash", | ||
"gemini-flash": "gemini-1.5-flash-8b", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The key 'gemini-flash' is duplicated in the |
||
} | ||
|
||
@classmethod | ||
async def create_async_generator( | ||
|
@@ -108,4 +114,4 @@ async def create_async_generator( | |
if candidate["finishReason"] == "STOP": | ||
yield candidate["content"]["parts"][0]["text"] | ||
else: | ||
yield candidate["finishReason"] + ' ' + candidate["safetyRatings"] | ||
yield candidate["finishReason"] + ' ' + candidate["safetyRatings"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,12 @@ def __init__(self, conversation_id: str): | |
self.conversation_id = conversation_id | ||
|
||
class GithubCopilot(AsyncGeneratorProvider, ProviderModelMixin): | ||
url = "https://copilot.microsoft.com" | ||
url = "https://github.com/copilot" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The URL should accurately reflect the service being used. Ensure that this URL is correct and serves the intended purpose. |
||
|
||
working = True | ||
needs_auth = True | ||
supports_stream = True | ||
|
||
default_model = "gpt-4o" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default model should be checked for its compatibility with the rest of the codebase and any potential updates or deprecations. |
||
models = [default_model, "o1-mini", "o1-preview", "claude-3.5-sonnet"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider reviewing the list of models to ensure they are all still valid and supported, as outdated models can lead to issues. |
||
|
||
|
@@ -90,4 +92,4 @@ async def create_async_generator( | |
if line.startswith(b"data: "): | ||
data = json.loads(line[6:]) | ||
if data.get("type") == "content": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The yield statement should be examined to ensure it correctly handles cases where 'body' may not be present in the data. |
||
yield data.get("body") | ||
yield data.get("body") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key "sdxl" is duplicated. Please ensure that each key is unique to avoid potential conflicts.