summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/H2o.py
diff options
context:
space:
mode:
authorTekky <98614666+xtekky@users.noreply.github.com>2023-09-22 21:40:59 +0200
committerGitHub <noreply@github.com>2023-09-22 21:40:59 +0200
commitba287e89b55118965ff0e151e54636b1f50d3b38 (patch)
treedc69218fecae4971c90ae391ff6919c032b93540 /g4f/Provider/H2o.py
parent~ | gpt-3.5-turbo-0613 (diff)
parentAdd RetryProvider (diff)
downloadgpt4free-ba287e89b55118965ff0e151e54636b1f50d3b38.tar
gpt4free-ba287e89b55118965ff0e151e54636b1f50d3b38.tar.gz
gpt4free-ba287e89b55118965ff0e151e54636b1f50d3b38.tar.bz2
gpt4free-ba287e89b55118965ff0e151e54636b1f50d3b38.tar.lz
gpt4free-ba287e89b55118965ff0e151e54636b1f50d3b38.tar.xz
gpt4free-ba287e89b55118965ff0e151e54636b1f50d3b38.tar.zst
gpt4free-ba287e89b55118965ff0e151e54636b1f50d3b38.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/H2o.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/g4f/Provider/H2o.py b/g4f/Provider/H2o.py
index 30090a58..d92bd6d1 100644
--- a/g4f/Provider/H2o.py
+++ b/g4f/Provider/H2o.py
@@ -23,7 +23,7 @@ class H2o(AsyncGeneratorProvider):
**kwargs
) -> AsyncGenerator:
model = model if model else cls.model
- headers = {"Referer": "https://gpt-gm.h2o.ai/"}
+ headers = {"Referer": cls.url + "/"}
async with ClientSession(
headers=headers
@@ -36,14 +36,14 @@ class H2o(AsyncGeneratorProvider):
"searchEnabled": "true",
}
async with session.post(
- "https://gpt-gm.h2o.ai/settings",
+ f"{cls.url}/settings",
proxy=proxy,
data=data
) as response:
response.raise_for_status()
async with session.post(
- "https://gpt-gm.h2o.ai/conversation",
+ f"{cls.url}/conversation",
proxy=proxy,
json={"model": model},
) as response:
@@ -71,7 +71,7 @@ class H2o(AsyncGeneratorProvider):
},
}
async with session.post(
- f"https://gpt-gm.h2o.ai/conversation/{conversationId}",
+ f"{cls.url}/conversation/{conversationId}",
proxy=proxy,
json=data
) as response:
@@ -83,6 +83,14 @@ class H2o(AsyncGeneratorProvider):
if not line["token"]["special"]:
yield line["token"]["text"]
+ async with session.delete(
+ f"{cls.url}/conversation/{conversationId}",
+ proxy=proxy,
+ json=data
+ ) as response:
+ response.raise_for_status()
+
+
@classmethod
@property
def params(cls):