MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / build_tool

Function build_tool

bmtools/tools/tutorial/api.py:12–39  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

10
11
12def build_tool(config) -> Tool:
13 tool = Tool(
14 tool_name="Tutorial",
15 description="Provide tutorial for foundation model based on a given objective.",
16 name_for_model="Tutorial",
17 description_for_model="Plugin for providing tutorial for a given objective.",
18 logo_url="https://your-app-url.com/.well-known/logo.png",
19 contact_email="xin.cong@outlook.com",
20 legal_info_url="hello@legal.com"
21 )
22 prompt = PromptTemplate.from_template(
23 "You are a planner who is an expert at coming up with a todo list for a given objective. Come up with a todo list for this objective: {objective}"
24 )
25
26 key = os.environ.get("OPENAI_API_KEY")
27 llm = OpenAI(model_name="gpt-3.5-turbo", temperature=0.0, openai_api_key=key)
28
29 chain = LLMChain(llm=llm, prompt=prompt)
30
31 @tool.get("/tutorial")
32 def tutorial(text: str) -> str:
33 """
34 tutorial(text: str) -> str: Providing a TODO list as a toturial for the foundation model based on the given objective.
35 """
36 result = chain.run(text)
37 return result
38
39 return tool

Callers

nothing calls this directly

Calls 1

ToolClass · 0.50

Tested by

no test coverage detected