mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-20 05:18:16 +00:00
implemented the run function for the tool
This commit is contained in:
@@ -58,4 +58,20 @@ class AIMindTool(BaseTool):
|
|||||||
name=name, datasources=datasources, replace=True
|
name=name, datasources=datasources, replace=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.mind_name = mind.name
|
self.mind_name = mind.name
|
||||||
|
|
||||||
|
def _run(
|
||||||
|
self,
|
||||||
|
query: Text
|
||||||
|
):
|
||||||
|
# Run the query on the AI-Mind.
|
||||||
|
# The Minds API is OpenAI compatible and therefore, the OpenAI client can be used.
|
||||||
|
openai_client = OpenAI(base_url="https://mdb.ai/", api_key=self.api_key)
|
||||||
|
|
||||||
|
completion = openai_client.create(
|
||||||
|
model=self.mind_name,
|
||||||
|
messages=[{"role": "user", "content": query}],
|
||||||
|
stream=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
return completion.choices[0].message.content
|
||||||
Reference in New Issue
Block a user