Commit graph

110 commits

Author SHA1 Message Date
hlohaus
9c7fc9fe4a Remove version declaration from Docker Compose files and update Dockerfile to streamline package installation 2025-11-14 19:52:57 +01:00
hlohaus
9b3e7a69d2 Refactor Dockerfile and backend API for improved image processing and dependency management 2025-10-31 03:52:10 +01:00
hlohaus
6b210f44f9 Refactor search and response handling; introduce CachedSearch and DDGS classes for improved web search functionality and response management. Add PlainTextResponse for handling plain text responses. Update requirements and setup for new dependencies. 2025-10-03 11:38:24 +02:00
H Lohaus
ed31d0e4e1
Update requirements.txt 2025-09-08 09:56:49 +02:00
hlohaus
acffc939cf Fix ddgs search 2025-07-13 12:55:59 +02:00
kqlio67
7965487830
feat: add new providers and update models (#3075)
* feat: add agent CLI, new providers, and update models

- Add a new `agent` mode to the CLI, a feature-rich AI coding assistant with capabilities for file system operations, code execution, git integration, and interactive chat.
- Add new provider `OperaAria` with support for vision, streaming, and conversation history.
- Add new provider `Startnest` with support for `gpt-4o-mini`, vision, and streaming.
- Move providers `FreeGpt` and `Websim` to the `not_working` directory.
- Delete the `OIVSCodeSer2` provider.
- Rename the CLI `client` mode to `chat` and refactor its argument parsing.

- In `g4f/Provider/DeepInfraChat.py`:
  - Add a new `api_endpoint` attribute.
    - Extensively update and reorganize the `models` list and `model_aliases` dictionary with numerous new models.

    - In `g4f/Provider/LambdaChat.py`:
      - Change the `default_model` to `deepseek-v3-0324`.

      - In `g4f/Provider/Together.py`:
        - Update aliases for `llama-3.1-405b`, `deepseek-r1`, and `flux`.
          - Add new models including `gemma-3-27b`, `gemma-3n-e4b`, and `qwen-3-32b`.

          - In `g4f/models.py`:
            - Add new model definitions for `aria`, `deepseek_v3_0324_turbo`, `deepseek_r1_0528_turbo`, and several `gemma` variants.
              - Remove the `mixtral_8x22b` model definition.
                - Update the `best_provider` lists for `default`, `default_vision`, `gpt_4o_mini`, `gemini-1.5-pro`, `gemini-1.5-flash`, and others to reflect provider changes.

                - In `g4f/Provider/__init__.py`:
                  - Add `OperaAria` and `Startnest` to the list of imported providers.
                    - Remove `FreeGpt`, `OIVSCodeSer2`, and `Websim` from imports.

                    - In `requirements.txt`:
                      - Add `rich` as a new dependency for the agent CLI.

* feat: add gemma-3-4b alias to DeepInfraChat

In g4f/Provider/DeepInfraChat.py, add the gemma-3-4b alias to the model_aliases dictionary.

The new alias points to the google/gemma-3-4b-it model.

* feat: add OIVSCodeSer2 provider

- Create the new provider file .
- The  provider supports the  model and includes a custom  method to generate a .
- Import and include  in .
- Add  to the  for  in .
- Add  to  in .

* feat: add OIVSCodeSer2 provider

- Create the new provider file .
- The  provider supports the  model and includes a custom  method to generate a .
- Import and include  in .
- Add  to the  for  in .
- Add  to  in .

* refactor: Migrate from duckduckgo-search to ddgs library

*   Replaced the  dependency with the new  library.
*   In , updated imports from  to  and  to .
*   Modified the  function in  to use an  context manager instead of a global instance.
*   Updated the  function to catch the new  exception.
*   In , updated the web search import and installation instructions to use .
*   Removed unnecessary comments and simplified f-string formatting in  and .
*   Added  and  to .
*   Added , , and  to the  extras in .

* test: Update web search tests for ddgs library and cleanup code

*   In `etc/unittest/web_search.py`, updated imports from `duckduckgo_search` to `ddgs` and `DDGSError`.
*   Added an import for `MissingRequirementsError` in `etc/unittest/web_search.py`.
*   Modified exception handling in web search tests to catch both `DDGSError` and `MissingRequirementsError`.
*   Removed temporary modification comments in `g4f/cli/agent/agent.py` and `g4f/tools/web_search.py`.

* fix: remove unstable CLI feature due to critical errors

- Remove the experimental CLI coding assistant feature due to multiple stability issues and critical errors in production environments
- Delete the entire `g4f/cli/agent/` directory and all related functionality
- Remove `rich` dependency from `requirements.txt` as it was only used by the removed feature
- Remove `rich` from the `all` extras in `setup.py`
- Revert CLI mode naming from `chat` back to `client` for consistency
- Clean up argument parsing in CLI to remove references to the removed functionality
- Remove installation instructions and imports related to the unstable feature from documentation

This removal is necessary due to:
- Unpredictable behavior causing data loss risks
- Incompatibility with certain system configurations
- Security concerns with unrestricted file system access
- Excessive resource consumption in production environments

Note: This feature may be reintroduced in the future with a more stable and secure implementation that addresses the current limitations and safety concerns.

---------

Co-authored-by: kqlio67 <kqlio67@users.noreply.github.com>
2025-07-11 03:50:59 +02:00
hlohaus
51b4b8bcb3 feat: add model alias handling and update Cloudflare provider
- Introduced `clean_name` function in `Cloudflare.py` to format model names by removing specific suffixes.
- Updated `model_aliases` in `Cloudflare` class with new model mappings, and cleaned up redundant entries.
- Set `models` in the `Cloudflare` class to use keys from `model_aliases`.
- Adjusted the caching logic in `Cloudflare` to include new headers for requests.
- Added `parent` and `login_url` attributes in `DeepInfraChat` class.
- Updated `PollinationsAI` to clean up model retrieval logic and fixed handling of existing checks.
- Refactored `HarProvider` to inherit models and aliases from `LegacyLMArena`.
- Implemented loading environment variables from `.env` file in `cookies.py`.
- Updated default headers in `defaults.py` for user agent and `sec-ch-ua`.
- Cleaned up various model references in `any_model_map.py` to reflect differences in audio, vision, and other model types.
- Added a more centralized handling for API key management in `run_tools.py` to accommodate new nomenclature.
- Enhanced existing logic to allow for more granular loading and utilization of API keys from environment variables.
2025-07-10 03:28:02 +02:00
H Lohaus
79b57d31a1
Update requirements.txt 2025-06-13 04:39:22 +02:00
hlohaus
93986d15f6 fix: resolve model duplication and improve provider handling
- Fixed duplicate model entries in Blackbox provider model_aliases
- Added meta-llama- to llama- name cleaning in Cloudflare provider
- Enhanced PollinationsAI provider with improved vision model detection
- Added reasoning support to PollinationsAI provider
- Fixed HuggingChat authentication to include headers and impersonate
- Removed unused max_inputs_length parameter from HuggingFaceAPI
- Renamed extra_data to extra_body for consistency across providers
- Added Puter provider with grouped model support
- Enhanced AnyProvider with grouped model display and better model organization
- Fixed model cleaning in AnyProvider to handle more model name variations
- Added api_key handling for HuggingFace providers in AnyProvider
- Added see_stream helper function to parse event streams
- Updated GUI server to handle JsonConversation properly
- Fixed aspect ratio handling in image generation functions
- Added ResponsesConfig and ClientResponse for new API endpoint
- Updated requirements to include markitdown
2025-05-16 00:18:12 +02:00
hlohaus
796d6d6e14 Fix errors on read buckets
Update requirements for docx
2025-02-19 17:10:03 +01:00
hlohaus
07aba23ef5 Fix docker build 2025-01-24 16:02:14 +01:00
hlohaus
ae978ad541 Add missing webview requirements
Fix web_search in Web UI
2025-01-15 22:45:52 +01:00
Heiner Lohaus
13b6fdef98 Add files requirements 2025-01-05 20:20:25 +01:00
H Lohaus
431db7b8ea
Update api / add a synthesize and upload_cookies endpoint (#2406)
* Add web_search function to OpenaiChat provider
* GithubCopilot provider added, it need a api_key
* Remove nodriver login in Gemini synthesize

* Update api / add a synthesize and upload_cookies endpoint
2024-11-23 00:17:35 +01:00
Heiner Lohaus
ea1448001d Add nodriver to Gemini provider,
Add slim docker image with google-chrome usage,
Add the new docker images to publish worklow,
Update requirements.txt and pip requirements
2024-11-17 11:06:37 +01:00
foxfire52
f38428ab23
Improve logging implementation (#2347) 2024-11-15 07:38:51 +01:00
kqlio67
db93a39b56 feat(requirements.txt): add cloudscraper for Cloudflare support 2024-10-11 09:20:19 +03:00
H Lohaus
49c4cb24ff
Update requirements.txt 2024-04-07 20:03:23 +02:00
Heiner Lohaus
d0da5900c4 Fix attr conversation_id not found 2024-03-27 19:04:00 +01:00
Heiner Lohaus
92358bd896 Update min requirements, Add pycryptodome 2024-03-25 21:19:13 +01:00
Heiner Lohaus
a56521b706 Add updated requirements 2024-03-22 13:01:07 +01:00
Heiner Lohaus
a892d7b935 Add updated requirements 2024-03-22 12:59:45 +01:00
Heiner Lohaus
8cc6000ffb Add Pyinstaller support, Use curl_cffi in You provider 2024-03-15 11:46:06 +01:00
H Lohaus
6ef282de3a
Remove all not working provider (#1679)
Fix many providers
Add selenium-wire to requierments
2024-03-12 02:06:06 +01:00
abc
dd46cfdf65 ~ 2024-03-11 12:57:59 +00:00
Heiner Lohaus
ccac427ac1 Fiy unittests with duckduckgo-search 5.0 2024-03-06 17:41:17 +01:00
Heiner Lohaus
51264fe20c Add GeminiPro API provider
Set min version for undetected-chromedriver
Add api_key to the new client
2024-02-23 11:33:38 +01:00
Heiner Lohaus
e5b7f72b71 Move some modules, create providers dir
Set min version for duckduckgo
Make duckduckgo search async
Remove get_lastet_version
2024-02-22 00:16:58 +01:00
Heiner Lohaus
a28bab9387 Add aiohttp_socks to requirements
Fix preview for uploaded and generated images in gui
Improve typing, readme
2024-01-29 18:14:46 +01:00
H Lohaus
feb83c168b
New minimum requirements (#1515)
* New minimum requirements
* Add ConversationStyleOptionSets to Bing
* Add image.ImageRequest
* Improve python version support
* Improve unittests
2024-01-26 07:54:13 +01:00
H Lohaus
42709f55b2
Fix unittests (#1472)
* Fix unittests

* Fix missing distutils, install setuptools

* Fix version not found

* Remove deprecation in get_event_loop
2024-01-14 16:37:21 +01:00
H Lohaus
d632190f1d
Merge branch 'main' into main 2024-01-13 15:52:52 +01:00
Heiner Lohaus
ea8d6b847a Support upload image in gui
Add image upload to OpenaiChat
Add image response to OpenaiChat
Improve ChatGPT Plus Support
Remove unused requirements
2024-01-13 15:37:36 +01:00
Akash Mondal
c2115309ab Cleanup unused dependencies
* remove packages, that are not a direct dependency to this project, from requirements.txt

* no need to just numpy for simple sqrt operation on numbers

* write code on python than using a js compiler
2024-01-13 18:31:28 +05:30
H Lohaus
bee75be8e3
Add create images to Bing (#1426)
Add create images from Bing
Add FreeChatgpt Provider
Fix Bard Provider
2024-01-10 10:34:56 +01:00
Fabian Affolter
0077baea9b
Replace bs4 with beautifulsoup4 2024-01-07 11:38:22 +01:00
Yifei Kong
1ba6b7a9b2
Depend on a stable version of curl_cffi 2023-12-17 14:56:47 +08:00
H Lohaus
484b96d850
Add websearch to gui (#1314)
* Add websearch to gui
* Fix version_check config
* Add version badge in README.md
* Show version in gui
* Add docker hub build
* Fix gui backend, improve style
2023-12-07 07:18:05 +01:00
Heiner Lohaus
2157ccbcdb Add get_session_from_browser as cloudflare bypass 2023-12-02 05:40:07 +01:00
madonchik123
b0276f6c9e
Added new provider PI (Hacky way to use) (#1291)
* Added new provider PI (Hacky way to use)

* Updated models endpoint made it show real info about the model.py

* Added cloudscraper to the requirements

* Fixed some bugs aka made streaming also return role
2023-12-01 23:11:52 +01:00
H Lohaus
60286431ad
Set min version for curl_cffi 2023-11-20 17:28:23 +01:00
abc
fd87be8257 ~ | add async requirements 2023-11-19 23:05:55 +00:00
abc
e6a7aeab07 ~ 2023-11-19 23:04:12 +00:00
abc
79761c6e42 ~ | g4f v-0.1.8.6 2023-11-19 22:58:45 +00:00
Tekky
ff81e31886
~ | add selenium 2023-11-19 22:46:09 +00:00
Heiner Lohaus
9239cadd8b Add Response Handler to OpenaiChat
Update Providers with WebDriver
Add WebDriverSession helper
Use native streaming in curl_cffi
2023-11-19 05:36:04 +01:00
Heiner Lohaus
745ea57c63 Add auto_continue to OpenaiChat
Update readme provider tables
2023-11-12 10:12:05 +01:00
Heiner Lohaus
c796ba2253 Add py_arkose_generator in OpenaiChat 2023-11-11 10:14:39 +01:00
hs_junxiang
a3c4e63577 fix: no module named 'flask' (#1216) 2023-11-07 10:18:17 +08:00
ThatLukinhasGuy
583d856c39
Update requirements.txt 2023-11-01 22:29:45 -03:00