summaryrefslogtreecommitdiffstats
path: root/phind
diff options
context:
space:
mode:
authorJohannes <johannesr@viken.no>2023-04-26 08:12:10 +0200
committerJohannes <johannesr@viken.no>2023-04-26 08:12:10 +0200
commit592bbaab8696785b4f58094becd83b716b09fea5 (patch)
tree574ce7efa8a3d2c4c8fa06996f75b45e30d9e021 /phind
parentcorrected error message (diff)
downloadgpt4free-592bbaab8696785b4f58094becd83b716b09fea5.tar
gpt4free-592bbaab8696785b4f58094becd83b716b09fea5.tar.gz
gpt4free-592bbaab8696785b4f58094becd83b716b09fea5.tar.bz2
gpt4free-592bbaab8696785b4f58094becd83b716b09fea5.tar.lz
gpt4free-592bbaab8696785b4f58094becd83b716b09fea5.tar.xz
gpt4free-592bbaab8696785b4f58094becd83b716b09fea5.tar.zst
gpt4free-592bbaab8696785b4f58094becd83b716b09fea5.zip
Diffstat (limited to '')
-rw-r--r--phind/__init__.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/phind/__init__.py b/phind/__init__.py
index bd54d82a..9f000c6f 100644
--- a/phind/__init__.py
+++ b/phind/__init__.py
@@ -53,8 +53,10 @@ class PhindResponse:
class Search:
def create(prompt: str, actualSearch: bool = True, language: str = 'en') -> dict: # None = no search
- if user_agent == '' or cf_clearance == '':
- raise ValueError('user_agent and cf_clearance must be set, refer to documentation')
+ if user_agent == '':
+ raise ValueError('user_agent must be set, refer to documentation')
+ if cf_clearance == '' :
+ raise ValueError('cf_clearance must be set, refer to documentation')
if not actualSearch:
return {
@@ -106,8 +108,11 @@ class Completion:
codeContext: str = '',
language: str = 'en') -> PhindResponse:
- if user_agent == '':
+ if user_agent == '' :
raise ValueError('user_agent must be set, refer to documentation')
+
+ if cf_clearance == '' :
+ raise ValueError('cf_clearance must be set, refer to documentation')
if results is None:
results = Search.create(prompt, actualSearch = True)
@@ -235,6 +240,8 @@ class StreamingCompletion:
if user_agent == '':
raise ValueError('user_agent must be set, refer to documentation')
+ if cf_clearance == '' :
+ raise ValueError('cf_clearance must be set, refer to documentation')
if results is None:
results = Search.create(prompt, actualSearch = True)