-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Choose the relevant tools, such as a knowledge base, a search engine,…
… or a database, based on the task requirements and the agent's mode.
- Loading branch information
Showing
4 changed files
with
115 additions
and
6 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
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,35 @@ | ||
class Database: | ||
def __init__(self): | ||
self.connection = None | ||
self.host = None | ||
self.port = None | ||
self.username = None | ||
self.password = None | ||
self.database_name = None | ||
|
||
def connect(self): | ||
if self.connection is not None: | ||
raise ValueError("Already connected") | ||
|
||
# Connect to the database using the configured parameters | ||
# ... | ||
|
||
self.connection = ... # store the connection object | ||
|
||
def disconnect(self): | ||
if self.connection is None: | ||
raise ValueError("Not connected") | ||
|
||
# Disconnect from the database | ||
# ... | ||
|
||
self.connection = None | ||
|
||
def execute_query(self, query): | ||
if self.connection is None: | ||
raise ValueError("Not connected") | ||
|
||
# Execute the given query on the database and return the result | ||
# ... | ||
|
||
# return result |
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 @@ | ||
class KnowledgeBase: | ||
def __init__(self): | ||
self.data = {} | ||
|
||
def add_data(self, key, value): | ||
self.data[key] = value | ||
|
||
def get_data(self, key): | ||
return self.data.get(key) |
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,19 @@ | ||
class SearchEngine: | ||
def __init__(self): | ||
self.name = "search_engine" | ||
self.parameters = { | ||
"model": "BERT", | ||
"input_source": "text", | ||
"output_format": "text", | ||
# ... | ||
} | ||
self.tools = { | ||
"search_engine": { | ||
"name": "Elasticsearch", | ||
"version": "7.14.0", | ||
"host": "localhost", | ||
"port": 9200, | ||
# ... | ||
}, | ||
# ... | ||
} |