Commit Graph

14 Commits

Author SHA1 Message Date
H Lohaus
0a070bdf10 feat: introduce AnyProvider & LM Arena, overhaul model/provider logic (#2925)
* feat: introduce AnyProvider & LM Arena, overhaul model/provider logic

- **Provider additions & removals**
  - Added `Provider/LMArenaProvider.py` with full async stream implementation and vision model support
  - Registered `LMArenaProvider` in `Provider/__init__.py`; removed old `hf_space/LMArenaProvider.py`
  - Created `providers/any_provider.py`; registers `AnyProvider` dynamically in `Provider`
- **Provider framework enhancements**
  - `providers/base_provider.py`
    - Added `video_models` and `audio_models` attributes
  - `providers/retry_provider.py`
    - Introduced `is_content()` helper; now treats `AudioResponse` as stream content
- **Cloudflare provider refactor**
  - `Provider/Cloudflare.py`
    - Re‑implemented `get_models()` with `read_models()` helper, `fallback_models`, robust nodriver/curl handling and model‑name cleaning
- **Other provider tweaks**
  - `Provider/Copilot.py` – removed `"reasoning"` alias and initial `setOptions` WS message
  - `Provider/PollinationsAI.py` & `PollinationsImage.py`
    - Converted `audio_models` from list to dict, adjusted usage checks and labels
  - `Provider/hf/__init__.py` – applies `model_aliases` remap before dispatch
  - `Provider/hf_space/DeepseekAI_JanusPro7b.py` – now merges media before upload
  - `needs_auth/Gemini.py` – dropped obsolete Gemini model entries
  - `needs_auth/GigaChat.py` – added lowercase `"gigachat"` alias
- **API & client updates**
  - Replaced `ProviderUtils` with new `Provider` map usage throughout API and GUI server
  - Integrated `AnyProvider` as default fallback in `g4f/client` sync & async flows
  - API endpoints now return counts of providers per model and filter by `x_ignored` header
- **GUI improvements**
  - Updated JS labels with emoji icons, provider ignore logic, model count display
- **Model registry**
  - Renamed base model `"GigaChat:latest"` ➜ `"gigachat"` in `models.py`
- **Miscellaneous**
  - Added audio/video flags to GUI provider list
  - Tightened error propagation in `retry_provider.raise_exceptions`

* Fix unittests

* fix: handle None conversation when accessing provider-specific data

- Modified `AnyProvider` class in `g4f/providers/any_provider.py`
- Updated logic to check if `conversation` is not None before accessing `provider.__name__` attribute
- Wrapped `getattr(conversation, provider.__name__, None)` block in an additional `if conversation is not None` condition
- Changed `setattr(conversation, provider.__name__, chunk)` to use `chunk.get_dict()` instead of the object directly
- Ensured consistent use of `JsonConversation` when modifying or assigning `conversation` data

* ```
feat: add provider string conversion & update IterListProvider call

- In g4f/client/__init__.py, within both Completions and AsyncCompletions, added a check to convert the provider from a string using convert_to_provider(provider) when applicable.
- In g4f/providers/any_provider.py, removed the second argument (False) from the IterListProvider constructor call in the async for loop.
```

---------

Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com>
2025-04-18 14:10:51 +02:00
kqlio67
0e78f74a17 Fix conflict g4f/Provider/PollinationsAI.py 2025-04-06 10:33:21 +03:00
hlohaus
2234d926b8 Fix "n" parameter in API, update models.py 2025-04-05 16:03:28 +02:00
kqlio67
54ef1a511c docs: update providers documentation and enhance support for Blackbox HAR auth
- Added "No auth / HAR file" authentication type in providers-and-models.md
- Added "Video generation" column to provider tables for future capability
- Updated model counts and provider capabilities throughout documentation
- Fixed ARTA provider with improved error handling and response validation
- Enhanced AllenAI provider with vision model support and proper image handling
- Significantly improved Blackbox provider:
  - Added HAR file authentication support
  - Added subscription status checking
  - Added premium/demo model differentiation
  - Improved session handling and error recovery
- Enhanced DDG provider with better error handling for challenges
- Improved PollinationsAI and PollinationsImage providers' model handling
- Added VideoModel class in g4f/models.py
- Added audio/video generation indicators in GUI components
- Added new Ai2 models: olmo-1-7b, olmo-2-32b, olmo-4-synthetic
- Added new commit message generation tool in etc/tool/commit.py
2025-04-04 13:36:28 +03:00
hlohaus
a1871dafeb Improve background page
Improve share js functions
Fix photoswipe in UI
Support n parameter in PollinationsAI
2025-03-26 21:39:19 +01:00
hlohaus
e76e5f7835 Use dynamtic aspect_ratio for image and video size 2025-03-23 14:47:26 +01:00
kqlio67
c79635aaeb Update models and providers with improved documentation and code structure (#2786)
* docs(docs/providers-and-models.md): update documentation structure and model listings

* refactor(g4f/debug.py): add type hints and docstrings

* refactor(g4f/tools/run_tools.py): Restructure tool handling and improve modularity

* refactor(g4f/providers/response.py): enhance type hints and code documentation

* feat(g4f/models.py): Update model providers and add new models

* feat(g4f/Provider/Blackbox.py): add encrypted session handling and model updates

* fix(g4f/Provider/ChatGptEs.py): migrate to curl_cffi for request handling and improve error resilience

* feat(g4f/Provider/DeepInfraChat.py): Update default model and add new DeepSeek variants

* feat(g4f/Provider/Free2GPT.py): add Gemini models and streamline headers

* feat(g4f/Provider/FreeGpt.py): Add support for Gemini 1.5 Flash model

* feat(g4f/Provider/Liaobots.py): Add Claude 3.7 models and update default GPT-4o

* fix(g4f/Provider/PollinationsAI.py): Correct model mappings and generation parameters

* feat(g4f/Provider/PollinationsImage.py): Add class identifier label

* chore(g4f/Provider/TeachAnything.py): Update default model and simplify model handling

* (g4f/Provider/Mhystical.py): Remove class implementation

* chore(g4f/Provider/Prodia.py > g4f/Provider/not_working/Prodia.py): mark Prodia provider as non-working

* feat(g4f/Provider/Blackbox.py): Add Claude 3.7 Sonnet model alias

* chore(g4f/models.py): Update model configurations

* fix(g4f/Provider/ChatGptEs.py): improve request reliability and nonce detection

---------

Co-authored-by: kqlio67 <>
2025-03-09 19:46:27 +01:00
kqlio67
07a8dfdff7 AI Provider and Model Updates: Adding New, Removing Deprecated, and Enhancing Functionality (#2739)
* docs(docs/providers-and-models.md): Update provider listings and model information

* feat(g4f/models.py): update model configurations and expand provider support

* fix(g4f/gui/client/static/js/chat.v1.js): correct provider checkbox initialization logic

* feat(g4f/Provider/Blackbox.py): update model configurations and premium handling

* feat(g4f/Provider/ChatGLM.py): add finish reason handling and update default model

* chore(g4f/Provider/DDG.py): Reorder model entries for consistency

* feat(g4f/Provider/ImageLabs.py): Update default image model to sdxl-turbo

* feat(g4f/Provider/Liaobots.py): update supported model configurations and aliases

* feat(g4f/Provider/OIVSCode.py): Update API endpoint and expand model support

* fix(g4f/Provider/needs_auth/CablyAI.py): Enforce authentication requirement

* Removed the provider (g4f/Provider/BlackboxAPI.py)

* fix(g4f/providers/base_provider.py): improve cache validation in AsyncAuthedProvider

* Update g4f/models.py

* fix(g4f/Provider/Liaobots.py): remove deprecated Gemini model aliases

* chore(g4f/models.py): Remove Grok-2 and update Gemini provider configurations

* chore(docs/providers-and-models.md): Remove deprecated Grok models from provider listings

* New provider added (g4f/Provider/AllenAI.py)

* feat(g4f/models.py): Add Ai2 models and update provider references

* feat(docs/providers-and-models.md): update providers and models documentation

* fix(g4f/models.py): update experimental model provider configuration

* fix(g4f/Provider/PollinationsImage.py): Initialize image_models list and update label

* fix(g4f/Provider/PollinationsAI.py): Resolve model initialization and alias conflicts

* refactor(g4f/Provider/PollinationsAI.py): improve model initialization and error handling

* refactor(g4f/Provider/PollinationsImage.py): Improve model synchronization and initialization

* Update g4f/Provider/AllenAI.py

---------

Co-authored-by: kqlio67 <>
2025-02-24 15:53:20 +01:00
hlohaus
ba60296677 Fix unittest, update model lists 2025-02-22 13:19:52 +01:00
hlohaus
b84f35f4e4 Improve model list in HuggingFace
WakeLook and disable count tokens for performance
Export and import settings in UI
Some styling improvments in UI
Fix curl_cffi updated bugs
2025-02-22 03:33:12 +01:00
hlohaus
470b795418 Show only free providers by default 2025-02-21 06:52:04 +01:00
kqlio67
b1de624963 fix(g4f/Provider/PollinationsAI.py): Remove duplicate model alias 2025-02-10 19:50:35 +02:00
hlohaus
c4e4d340c4 Update PollinationsImage provider 2025-02-04 16:46:30 +01:00
hlohaus
1d00be5b91 Fix api_key in HuggingFace provider
Split PollinationsAI provider in two provider
Update model list in CablyAI
Return backup url, if copy images failed
Update url for logging in UI
2025-02-04 16:25:51 +01:00