summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/needs_auth/PerplexityApi.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-05-15 21:07:49 +0200
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-05-15 21:07:49 +0200
commit24c5502d7601ba3f2c5ab459015c74002b3af5c6 (patch)
treef9a4170ef8c5b0358bc4cf7189f997e3098ee0f3 /g4f/Provider/needs_auth/PerplexityApi.py
parentUpdate README.md (diff)
downloadgpt4free-24c5502d7601ba3f2c5ab459015c74002b3af5c6.tar
gpt4free-24c5502d7601ba3f2c5ab459015c74002b3af5c6.tar.gz
gpt4free-24c5502d7601ba3f2c5ab459015c74002b3af5c6.tar.bz2
gpt4free-24c5502d7601ba3f2c5ab459015c74002b3af5c6.tar.lz
gpt4free-24c5502d7601ba3f2c5ab459015c74002b3af5c6.tar.xz
gpt4free-24c5502d7601ba3f2c5ab459015c74002b3af5c6.tar.zst
gpt4free-24c5502d7601ba3f2c5ab459015c74002b3af5c6.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/needs_auth/PerplexityApi.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/g4f/Provider/needs_auth/PerplexityApi.py b/g4f/Provider/needs_auth/PerplexityApi.py
new file mode 100644
index 00000000..35d8d9d6
--- /dev/null
+++ b/g4f/Provider/needs_auth/PerplexityApi.py
@@ -0,0 +1,31 @@
+from __future__ import annotations
+
+from .Openai import Openai
+from ...typing import AsyncResult, Messages
+
+class PerplexityApi(Openai):
+ label = "Perplexity API"
+ url = "https://www.perplexity.ai"
+ working = True
+ default_model = "llama-3-sonar-large-32k-online"
+ models = [
+ "llama-3-sonar-small-32k-chat",
+ "llama-3-sonar-small-32k-online",
+ "llama-3-sonar-large-32k-chat",
+ "llama-3-sonar-large-32k-online",
+ "llama-3-8b-instruct",
+ "llama-3-70b-instruct",
+ "mixtral-8x7b-instruct"
+ ]
+
+ @classmethod
+ def create_async_generator(
+ cls,
+ model: str,
+ messages: Messages,
+ api_base: str = "https://api.perplexity.ai",
+ **kwargs
+ ) -> AsyncResult:
+ return super().create_async_generator(
+ model, messages, api_base=api_base, **kwargs
+ ) \ No newline at end of file