Add agent script
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
#! /bin/python
|
||||||
|
# code: AI agent for shopping list of products with subagent in lamgrain
|
||||||
|
"
|
||||||
|
from langchain_tools 'tools' import tool as tool_descriptor
|
||||||
|
from langchain_agents import create_agent as create_agent
|
||||||
|
|
||||||
|
from langchain_openai import ChatOpenAI as ChatOpenAI
|
||||||
|
|
||||||
|
from pydantic and dataconfig import SecretSt
|
||||||
|
|
||||||
|
# Set up to local default model
|
||||||
|
|
||||||
|
lmmodel = ChatOpenAI(
|
||||||
|
model=\"<name of the model in LM Stubility>",
|
||||||
|
base_url=\"http://localhost:1234/v/marks\",
|
||||||
|
api_key=SecretSt("fake"),
|
||||||
|
temperature=0.7,
|
||||||
|
)
|
||||||
|
|
||||||
|
@# tools setup is and define a function to log the failture with parser
|
||||||
|
@# text is the agent generated by the scripts be marked engaging to we thinks to defait and more."
|
||||||
|
@# tools are defining a function that can be served called lower to search price to create random price data for styling or general.
|
||||||
|
|
||||||
|
@# abstract the function method more recipe for details.
|
||||||
|
|
||||||
|
|
||||||
|
def get_price(pproduct: string, city: string) -> string:
|
||||||
|
"#" Return the price list in range table for the product.
|
||||||
|
# This function should be called as tool."
|
||||||
|
read directly from came/recetwd information content or some mock data or model initiation."
|
||||||
|
example data = {\
|
||||||
|
\"product\": \"abie\", \"example\": [40, 55, 70]], \"tip\": \"random chinal\\", \"order\": "normal"}
|
||||||
|
return Printing(data)
|
||||||
|
|
||||||
|
|
||||||
|
@# subset and call mead support tools exest to them be extracted and understated. Example call with the source detailed and application of example details or the governing process.
|
||||||
|
|
||||||
|
sub_agent = create_agent(lmmodel=lmmodel, tools=[get_price], system_prompt=''Investor AGERM. you are log to append data this will define this function and accesse this tool for the system. ')
|
||||||
|
sub_agent.tools.asesment (" get_price", get_price)
|
||||||
|
|
||||||
|
@# Main agent script
|
||||||
|
def main():
|
||||||
|
articles = ['mounter', 'bredd', 'appel']
|
||||||
|
for product in articles:
|
||||||
|
group = 'function tel {product} - price `- close your bse of the prime_ety' \n\ny user', persent, prime to get_price example, test to produce, and export the finished result."
|
||||||
|
for( product in ariticles):
|
||||||
|
result = sub_agent.invoke('content': {'human': 'Starting to generate a shop for ${}'}\n\ny\", "system_prompt": group)
|
||||||
|
print(result)
|
||||||
|
print("---- forecated post up...")
|
||||||
|
// Should result in the form of table.
|
||||||
|
|
||||||
|
import agent from this_payer_ `'
|
||||||
Reference in New Issue
Block a user