xin li
11/13/2024, 9:47 AM@cf.flowdef gen_mock_data(goal: str):agent_data = cf.Agent(name = "Website data structure generator",instructions = """You are a data structure expert. Your task is to generate realistic mock data for a website. You can directly return final result data in tool call without any other comments.""",# model = openai_model,model = model, # anthropic sonnect 3.5)mock_data_task = cf.Task(objective=f"""Please follow these guidelines:1. Include all necessary fields and relationships between data entities2. Generate a reasonable amount of sample data (10-20 items per category)3. Maintain data consistency across related entities4. Use realistic values for:- Names, titles, descriptions- Dates and timestamps- IDs and reference keys- Numeric values and statistics5. Follow these data quality rules:- No null values unless explicitly requested- Proper data types for each field- Consistent formatting for dates and special fields- Realistic data ranges and distributionsGenerate mock data for the goal: {goal}""",result_type=dict,#  completion_tools=[],agents=[agent_data],)json_data = mock_data_task.run(max_agent_turns=3,max_llm_calls=3,)print("Mock data:", json_data)gen_mock_data("Generate a blog site mock data")Jeremiah
Jeremiah
objectimport controlflow as cf
@cf.flow
def gen_mock_data(goal: str):
    agent_data = cf.Agent(
        name="Website data structure generator",
        instructions="""You are a data structure expert. Your task is to generate realistic mock data for a website. You can directly return final result data in tool call without any other comments.""",
        model="anthropic/claude-3-5-sonnet-20240620",
    )
    mock_data_task = cf.Task(
        objective=f"""
        Please follow these guidelines:
    1. Include all necessary fields and relationships between data entities
    2. Generate a reasonable amount of sample data (10-20 items per category)
    3. Maintain data consistency across related entities
    4. Use realistic values for:
    - Names, titles, descriptions
    - Dates and timestamps
    - IDs and reference keys
    - Numeric values and statistics
    5. Follow these data quality rules:
    - No null values unless explicitly requested
    - Proper data types for each field
    - Consistent formatting for dates and special fields
    - Realistic data ranges and distributions
    
    6. In the interest of efficiency, don't exceed 1000 characters.
    
        Generate mock data for the goal: {goal}""",
        result_type=dict,
        #  completion_tools=[],
        agents=[agent_data],
    )
    json_data = mock_data_task.run(
        max_agent_turns=3,
        max_llm_calls=3,
    )
    print("Mock data:", json_data)
gen_mock_data("Generate a blog site mock data")Jeremiah
