Skip to content

Commit

Permalink
- patch: FreeGpt default g4f-based provider.
Browse files Browse the repository at this point in the history
- added: `g4f` made required dependency.
- fix: `openai` response repetition. Resolves #39
- Other minor fixes.
  • Loading branch information
Simatwa committed Mar 15, 2024
1 parent c5c487e commit f8e9fee
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
11 changes: 10 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,4 +434,13 @@ For instance:
**What's new?**

- fix: Gemini (Bard) provider.
- added: awesome prompts info.
- added: awesome prompts info.

## v0.5.5

**What's new?**

- patch: `FreeGpt` default g4f-based provider.
- added: `g4f` made required dependency.
- fix: `openai` response repetition. [#39](https://github.com/Simatwa/python-tgpt/issues/39)
- Other minor fixes.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"clipman==3.1.0",
"pyperclip==1.8.2",
"colorama==0.4.6",
"g4f>=0.2.2.6",
"g4f>=0.2.4.1",
"python-dotenv==1.0.0",
]

Expand All @@ -40,7 +40,7 @@

setup(
name="python-tgpt",
version="0.5.4",
version="0.5.5",
license="MIT",
author="Smartwa",
maintainer="Smartwa",
Expand Down
6 changes: 3 additions & 3 deletions src/pytgpt/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ class ChatInteractive:
"--top-k",
help="Chance of topic being repeated",
type=click.FLOAT,
default=-1,
default=0,
)
@click.option(
"-k",
Expand Down Expand Up @@ -1431,7 +1431,7 @@ class ChatGenerate:
"--top-k",
help="Chance of topic being repeated",
type=click.FLOAT,
default=-1,
default=0,
)
@click.option(
"-k",
Expand Down Expand Up @@ -2103,7 +2103,7 @@ def gui(port, address, debug, open):
"-t",
"--timeout",
type=click.INT,
help="Provider response generation tiemout",
help="Provider's response generation timeout",
default=20,
)
@click.option(
Expand Down
2 changes: 1 addition & 1 deletion src/pytgpt/gpt4free/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .main import completion_allowed_models

__info__ = (
"Interact with various free models bundled by https://github.com/xtekky/gpt4free"
"Interact with various free ai providers bundled by https://github.com/xtekky/gpt4free"
)

all = [
Expand Down
4 changes: 2 additions & 2 deletions src/pytgpt/gpt4free/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"chat_completion": "gpt-3.5-turbo",
}

default_provider = "You"
default_provider = "FreeGpt"


class GPT4FREE(Provider):
Expand All @@ -47,7 +47,7 @@ def __init__(
"""Initialies GPT4FREE
Args:
provider (str, optional): gpt4free based provider name. Defaults to Aura.
provider (str, optional): gpt4free based provider name. Defaults to FreeGpt.
is_conversation (bool, optional): Flag for chatting conversationally. Defaults to True.
auth (str, optional): Authentication value for the provider incase it needs. Defaults to None.
max_tokens (int, optional): Maximum number of tokens to be generated upon completion. Defaults to 600.
Expand Down
2 changes: 2 additions & 0 deletions src/pytgpt/gpt4free/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def is_working(provider: str) -> bool:
assert isinstance(text, str)
assert bool(text.strip())
assert "</" not in text
assert ":" not in text
assert len(text) > 2
return True

Expand Down Expand Up @@ -126,6 +127,7 @@ def test_provider(self, name: str):
assert isinstance(text, str), "Non-string response returned"
assert bool(text.strip()), "Empty string"
assert "</" not in text, "Html code returned."
assert ":" not in text, "Json formatted response returned"
assert len(text) > 2
except Exception as e:
pass
Expand Down

0 comments on commit f8e9fee

Please sign in to comment.