-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from OpenBMB/format_answer_generation_code
Format answer generation code
- Loading branch information
Showing
12 changed files
with
163 additions
and
592 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
data/ | ||
data.zip | ||
*.DS_store | ||
|
||
__MACOSX/ | ||
|
||
run.bash | ||
|
||
*.pyc |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,33 @@ | ||
class base_search_method: | ||
from Downstream_tasks.base_env import base_env | ||
|
||
def __init__(self): | ||
class base_search_method: | ||
"""For the base tree search method, you need to support the following functions""" | ||
|
||
def __init__(self,llm,io_func: base_env, process_id=0, callbacks = None): | ||
"""Args: | ||
llm: The interface of the LLM | ||
io_func(base_env): Interface to the environment, | ||
process_id (int, optional): In multiprocessing annotation, this describes the process id. Defaults to 0. | ||
callbacks (_type_, optional): _description_. Defaults to None. | ||
""" | ||
pass | ||
|
||
def to_json(self): | ||
def to_json(self,answer=False,process=True): | ||
''' | ||
return a json object, | ||
If "answer" = True. must have the following field to make answer annotation | ||
If "process" = True. You need provide the full information of the tree searching process | ||
"answer_generation": { | ||
"valid_data": bool, | ||
"final_answer": string, | ||
"chain": [ | ||
{ | ||
"thought":string, | ||
"action_name":string, | ||
"action_input":string, | ||
"observation": string, | ||
} | ||
], | ||
"finish_type": enum["give_up","give_answer"] | ||
"train_messages": [ [openAI-message] ], | ||
} | ||
as answer data | ||
''' | ||
raise NotImplementedError | ||
|
||
def start(self): | ||
def start(self, **args): | ||
"""This is the entry point of the searching process""" | ||
raise NotImplementedError | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.