diff options
-rw-r--r-- | phind/__init__.py | 11 | ||||
-rw-r--r-- | you/__init__.py | 5 |
2 files changed, 12 insertions, 4 deletions
diff --git a/phind/__init__.py b/phind/__init__.py index 9b1650e0..9f000c6f 100644 --- a/phind/__init__.py +++ b/phind/__init__.py @@ -55,6 +55,8 @@ class Search: def create(prompt: str, actualSearch: bool = True, language: str = 'en') -> dict: # None = no search 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) @@ -281,4 +288,4 @@ class StreamingCompletion: @staticmethod def handle_stream_response(response): - StreamingCompletion.message_queue.put(response)
\ No newline at end of file + StreamingCompletion.message_queue.put(response) diff --git a/you/__init__.py b/you/__init__.py index 726773ef..073daee9 100644 --- a/you/__init__.py +++ b/you/__init__.py @@ -64,7 +64,8 @@ class Completion: text = response.text.split('}]}\n\nevent: youChatToken\ndata: {"youChatToken": "')[-1] text = text.replace('"}\n\nevent: youChatToken\ndata: {"youChatToken": "', '') text = text.replace('event: done\ndata: I\'m Mr. Meeseeks. Look at me.\n\n', '') - + text = text[:-4] # trims '"}', along with the last two remaining newlines + extra = { 'youChatSerpResults' : loads(youChatSerpResults), #'slots' : loads(slots) @@ -74,4 +75,4 @@ class Completion: 'response': text, 'links' : loads(thirdPartySearchResults)['search']["third_party_search_results"] if includelinks else None, 'extra' : extra if detailed else None, - }
\ No newline at end of file + } |