summaryrefslogtreecommitdiffstats
path: root/g4f/.v1/unfinished/bard/typings.py
diff options
context:
space:
mode:
authorMIDORIBIN <aquarion123@gmail.com>2023-07-28 12:07:17 +0200
committerMIDORIBIN <aquarion123@gmail.com>2023-08-14 04:46:32 +0200
commitf6ef3cb2237d8c336e915ef77ddbe6f37934c4fd (patch)
treec8bc44917ea03909cf586140f984ff0814bc30ea /g4f/.v1/unfinished/bard/typings.py
parent~ | small fixes & new pypi version | v-0.0.1.9 (diff)
downloadgpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.gz
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.bz2
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.lz
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.xz
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.zst
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.zip
Diffstat (limited to 'g4f/.v1/unfinished/bard/typings.py')
-rw-r--r--g4f/.v1/unfinished/bard/typings.py54
1 files changed, 0 insertions, 54 deletions
diff --git a/g4f/.v1/unfinished/bard/typings.py b/g4f/.v1/unfinished/bard/typings.py
deleted file mode 100644
index 75b73bf9..00000000
--- a/g4f/.v1/unfinished/bard/typings.py
+++ /dev/null
@@ -1,54 +0,0 @@
-from typing import Dict, List, Union
-
-
-class BardResponse:
- def __init__(self, json_dict: Dict[str, Union[str, List]]) -> None:
- """
- Initialize a BardResponse object.
-
- :param json_dict: A dictionary containing the JSON response data.
- """
- self.json = json_dict
-
- self.content = json_dict.get('content')
- self.conversation_id = json_dict.get('conversation_id')
- self.response_id = json_dict.get('response_id')
- self.factuality_queries = json_dict.get('factualityQueries', [])
- self.text_query = json_dict.get('textQuery', [])
- self.choices = [self.BardChoice(choice)
- for choice in json_dict.get('choices', [])]
-
- def __repr__(self) -> str:
- """
- Return a string representation of the BardResponse object.
-
- :return: A string representation of the BardResponse object.
- """
- return f"BardResponse(conversation_id={self.conversation_id}, response_id={self.response_id}, content={self.content})"
-
- def filter_choices(self, keyword: str) -> List['BardChoice']:
- """
- Filter the choices based on a keyword.
-
- :param keyword: The keyword to filter choices by.
- :return: A list of filtered BardChoice objects.
- """
- return [choice for choice in self.choices if keyword.lower() in choice.content.lower()]
-
- class BardChoice:
- def __init__(self, choice_dict: Dict[str, str]) -> None:
- """
- Initialize a BardChoice object.
-
- :param choice_dict: A dictionary containing the choice data.
- """
- self.id = choice_dict.get('id')
- self.content = choice_dict.get('content')[0]
-
- def __repr__(self) -> str:
- """
- Return a string representation of the BardChoice object.
-
- :return: A string representation of the BardChoice object.
- """
- return f"BardChoice(id={self.id}, content={self.content})"