├── .cruft.json ├── .devcontainer └── devcontainer.json ├── .dockerignore ├── .envDemo ├── .gitattributes ├── .github └── workflows │ ├── deploy.yml │ └── test.yml ├── .gitignore ├── .lh ├── .lhignore ├── features │ └── reminder_app.feature.json ├── src │ └── dspygen │ │ ├── __init__.py.json │ │ ├── experiments │ │ ├── auto_spider │ │ │ └── spider_main.py.json │ │ ├── cal_apps │ │ │ ├── __init__.py.json │ │ │ ├── calendar_item.py.json │ │ │ ├── eventkit_mocks.py.json │ │ │ ├── reminder.py.json │ │ │ ├── reminder_app.py.json │ │ │ └── reminder_list.py.json │ │ ├── event_kit │ │ │ ├── event_kit_service.py.json │ │ │ ├── event_kit_store_service.py.json │ │ │ └── workbench.py.json │ │ ├── event_kit_v3 │ │ │ └── export.py.json │ │ ├── reminders_models.py.json │ │ ├── test_wa_reminders.py.json │ │ └── wa_reminders.py.json │ │ ├── rdddy │ │ ├── actor_system.py.json │ │ └── service_colony.py.json │ │ └── utils │ │ └── reminder_tools.py.json └── tests │ ├── actor │ └── test_actor_system.py.json │ ├── experiments │ ├── cal_apps │ │ ├── conftest.py.json │ │ ├── reminder_app.feature.json │ │ ├── test_reminder.py.json │ │ └── test_reminder_app_bdd.py.json │ ├── test_reminders_models.py.json │ └── test_wa_reminders.py.json │ ├── test_event_kit_service.py.json │ ├── test_event_kit_service_integration.py.json │ └── test_reminder_app.py.json ├── .pre-commit-config.yaml ├── CONTRIBUTING.md ├── Chinook.db ├── DISCLAIMER ├── Dockerfile ├── LICENSE ├── README.md ├── _templates ├── generator │ ├── help │ │ └── index.ejs.t │ ├── new │ │ └── hello.ejs.t │ └── with-prompt │ │ ├── hello.ejs.t │ │ └── prompt.ejs.t ├── init │ └── repo │ │ └── new-repo.ejs.t └── next │ ├── api │ ├── route.ejs.t │ └── type.ejs.t │ ├── crud │ ├── api-route.ejs.t │ ├── id-page.ejs.t │ ├── layout.ejs.t │ ├── page.ejs.t │ └── type.ejs.t │ ├── new │ └── new-template.ejs.t │ ├── route │ ├── layout.ejs.t │ └── page.ejs.t │ └── type │ └── type.ejs.t ├── bpmn_engine.mm ├── chain.yaml ├── docker-compose.dev.yml ├── docker-compose.yml ├── frontend ├── .env.example ├── .eslintrc.json ├── .gitignore ├── .nvmrc ├── README.md ├── app │ ├── api │ │ ├── comment │ │ │ └── route.ts │ │ ├── contract │ │ │ └── route.ts │ │ ├── document │ │ │ └── route.ts │ │ ├── task │ │ │ └── route.ts │ │ ├── todo │ │ │ └── route.ts │ │ └── unnamed │ │ │ └── route.ts │ ├── assessment │ │ └── [step] │ │ │ └── page.tsx │ ├── code │ │ ├── layout.tsx │ │ └── page.tsx │ ├── comment │ │ ├── [id] │ │ │ └── page.tsx │ │ ├── layout.tsx │ │ └── page.tsx │ ├── contract │ │ ├── [id] │ │ │ └── page.tsx │ │ ├── layout.tsx │ │ └── page.tsx │ ├── document │ │ ├── [id] │ │ │ └── page.tsx │ │ ├── layout.tsx │ │ └── page.tsx │ ├── layout.tsx │ ├── report │ │ └── page.tsx │ ├── summary │ │ ├── layout.tsx │ │ └── page.tsx │ ├── task │ │ ├── [id] │ │ │ └── page.tsx │ │ ├── layout.tsx │ │ └── page.tsx │ ├── todo │ │ ├── [id] │ │ │ └── page.tsx │ │ ├── layout.tsx │ │ └── page.tsx │ └── unnamed │ │ ├── layout.tsx │ │ └── page.tsx ├── db.json ├── next.config.js ├── package-lock.json ├── package.json ├── postcss.config.js ├── prettier.config.js ├── public │ ├── assessment-questions.txt │ ├── customers │ │ ├── amy-burns.png │ │ ├── balazs-orban.png │ │ ├── delba-de-oliveira.png │ │ ├── emil-kowalski.png │ │ ├── evil-rabbit.png │ │ ├── guillermo-rauch.png │ │ ├── hector-simpson.png │ │ ├── jared-palmer.png │ │ ├── lee-robinson.png │ │ ├── michael-novotny.png │ │ ├── steph-dietz.png │ │ └── steven-tey.png │ ├── favicon.ico │ ├── hero-desktop.png │ ├── hero-mobile.png │ ├── opengraph-image.png │ └── pipeline.yaml ├── schemas │ ├── schemaPage1.json │ ├── schemaPage2.json │ ├── schemaPage3.json │ ├── schemaPage4.json │ └── schemaPage5.json ├── scripts │ └── seed.js ├── tailwind.config.ts ├── tsconfig.json ├── types │ ├── comment.ts │ ├── contract.ts │ ├── document.ts │ ├── task.ts │ ├── todo.ts │ └── unnamed.ts ├── utils │ └── api-tools.ts └── yarn.lock ├── gpts └── dspy_wizard.txt ├── module_script.sh ├── mosquitto └── config │ └── mosquitto.conf ├── ngrok.yml ├── notes └── GENETIC_TASKS.md ├── path └── to │ └── tetris_game.py ├── pep8_custom_inst ├── poetry.lock ├── pygame.quit() ├── pyproject.toml ├── report_pipeline.yaml ├── signatures └── generate_answer.py ├── src └── dspygen │ ├── __init__.py │ ├── agents │ ├── __init__.py │ ├── analytics_agent.py │ ├── business_logic.py │ ├── challenger_agent.py │ ├── coder_agent.py │ ├── coder_agent_v2.py │ ├── coder_agent_v3.py │ ├── coder_agent_v4.py │ ├── gantt_agents │ │ ├── __init__.py │ │ ├── gantt_agent.py │ │ ├── gantt_main.py │ │ ├── gen-orch-planner.pddl │ │ ├── openapi.yaml │ │ ├── pddl_openapi.py │ │ └── pddl_planning.py │ ├── idapr_adapter.py │ ├── mock_dapr_adapter.py │ ├── order_payload.py │ ├── pytest_agent.py │ ├── research_agent.py │ ├── swarms │ │ ├── __init__.py │ │ ├── agent.http │ │ ├── db.json │ │ ├── go_high_level_swarm.py │ │ ├── pso.py │ │ └── self_talk_swarm.py │ └── workflow_agent.py │ ├── api.py │ ├── app.py │ ├── async_typer.py │ ├── books │ └── socratic_tutor │ │ ├── book.toml │ │ └── src │ │ ├── SUMMARY.md │ │ ├── appendices │ │ ├── README.md │ │ ├── further-reading.md │ │ └── glossary.md │ │ ├── architecture │ │ ├── actor-model.md │ │ ├── content-management.md │ │ ├── domain-model.md │ │ ├── event-driven.md │ │ ├── feedback-generation.md │ │ ├── question-generation.md │ │ └── student-modeling.md │ │ ├── best-practices │ │ ├── collaboration.md │ │ ├── domain-modeling.md │ │ ├── error-handling.md │ │ ├── future-enhancements.md │ │ └── performance.md │ │ ├── chapter_1.md │ │ ├── foundations │ │ ├── ddd.md │ │ ├── language-models.md │ │ ├── language-models │ │ │ ├── in-context-learning.md │ │ │ ├── prompt-engineering.md │ │ │ └── sparse-representations.md │ │ └── reactive.md │ │ ├── implementation │ │ ├── application-services.md │ │ ├── code-generation.md │ │ ├── domain-services.md │ │ ├── infrastructure.md │ │ ├── infrastructure │ │ │ ├── message-brokers.md │ │ │ └── persistence.md │ │ ├── language-model-integration.md │ │ └── project-structure.md │ │ ├── introduction │ │ └── overview.md │ │ └── testing │ │ ├── ci-cd.md │ │ ├── integration-testing.md │ │ ├── monitoring.md │ │ └── unit-testing.md │ ├── bpel_diagrams │ ├── __init__.py │ └── mermaid_multi_module_demo.py │ ├── bpel_models │ ├── __init__.py │ ├── activities.py │ ├── correlations.py │ ├── event_handlers.py │ ├── fault_handlers.py │ ├── links.py │ ├── partner_links.py │ ├── process.py │ └── variables.py │ ├── bpmn_models │ ├── __init__.py │ ├── artifacts.py │ ├── connecting_objects.py │ ├── events.py │ ├── flow_objects.py │ ├── gateways.py │ ├── other_entities.py │ ├── pools_and_lanes.py │ └── sub_processes.py │ ├── chatgpt_integration.py │ ├── cli.py │ ├── config.yaml │ ├── di_configure.py │ ├── dspygen_app.py │ ├── email_utils.py │ ├── experiments │ ├── 4www.py │ ├── __init__.py │ ├── agile_protocol │ │ ├── __init__.py │ │ └── aps_models.py │ ├── aider_bp │ │ ├── __init__.py │ │ ├── aider_blueprint.py │ │ └── blueprint_to_aider.py │ ├── auto_spider │ │ ├── __init__.py │ │ ├── example.png │ │ ├── sean_chatman.json │ │ └── spider_main.py │ ├── bkgn │ │ ├── __init__.py │ │ ├── book_config.py │ │ ├── chapter_draft.py │ │ ├── get_book_files.py │ │ ├── get_leaf.py │ │ ├── get_soc_files.py │ │ ├── quick_demo.py │ │ └── summary_config.yaml │ ├── blog │ │ ├── Tetris_1.md │ │ ├── Tetris_LMStud_Llama3.py │ │ ├── Tetris_groq.py │ │ └── Tetris_groq_llama3_80.py │ ├── bulk_code_generator │ │ ├── __init__.py │ │ └── main.py │ ├── business_patterns_for_devs.py │ ├── cliapi │ │ ├── __init__.py │ │ ├── cli_app.py │ │ ├── cliapi-history.txt │ │ ├── cliapi.md │ │ ├── cliapi_gen.py │ │ ├── cliapi_models.py │ │ ├── cliapigen-history.txt │ │ ├── github_cli.yaml │ │ ├── rovo_cli.py │ │ ├── test_cli_app.py │ │ ├── test_cli_gen.py │ │ ├── test_cli_gen_v2.py │ │ └── voice_llm.md │ ├── cmdgen │ │ ├── __init__.py │ │ └── gen_miro.py │ ├── domain_xml │ │ ├── __init__.py │ │ └── xml_main.py │ ├── domains │ │ ├── __init__.py │ │ ├── domains.yaml │ │ └── render_domains.py │ ├── done │ │ ├── CriticFeedbackGeneratorSignature_pipeline.yaml │ │ ├── WebsitePRD_pipeline.yaml │ │ ├── __init__.py │ │ ├── chatbots.py │ │ ├── code_generator_agent.py │ │ ├── data_pipeline.yaml │ │ ├── file_path.py │ │ ├── first_step_with_user_input.py │ │ ├── gen_dsl_instances.py │ │ ├── gen_pydantic_class.py │ │ ├── gherkin_parser.py │ │ ├── lm_call.py │ │ ├── openai_ror_cli.py │ │ ├── python_to_elixir.py │ │ ├── raw_to_structure_module.yaml │ │ ├── saltcorn_plugin_generator.py │ │ ├── saltcorn_plugin_generator_output.yaml │ │ ├── socket_actor_system.py │ │ ├── sql_to_natural_signature.yaml │ │ ├── test_openai_ror_cli.py │ │ ├── two_steps_with_user_input.py │ │ ├── understand_input_pipeline.yaml │ │ └── wizard.py │ ├── email_export.py │ ├── function_calling │ │ ├── Chinook.db │ │ ├── __init__.py │ │ ├── function_call.py │ │ ├── sql_calling_asserts.py │ │ ├── sql_optimization_function.py │ │ ├── weather_function_calling_asserts.py │ │ └── weather_functions.exs │ ├── gh_actions │ │ ├── __init__.py │ │ └── gh_actions_models.py │ ├── gherkin_gen │ │ ├── __init__.py │ │ ├── docstring.j2 │ │ ├── gherkin_instances.py │ │ └── gherkin_scenario.py │ ├── go_high_level │ │ ├── __init__.py │ │ └── ghl_scraper.py │ ├── linkedin_article │ │ ├── AutoMate-_Specialist_and_Generalist_Assembly_Policies_over_Diverse_Geometries_linkedin_article.txt │ │ ├── Collective_behavior_from_surprise_minimization_linkedin_article.txt │ │ ├── __init__.py │ │ └── article_gen.py │ ├── mock_gen │ │ ├── __init__.py │ │ ├── auto_pytest_mock_rover.py │ │ ├── json_schema_descriptions_dataset.py │ │ ├── json_signature_optimizer.py │ │ ├── jsonpro_optimizer.py │ │ ├── min_example.py │ │ ├── mipro_example.py │ │ ├── mipro_swe_bench_example.py │ │ ├── optimized_cot_sig_1715357653.470071.json │ │ ├── optimized_signature.json │ │ ├── swe_bench.py │ │ ├── swebench_example.py │ │ ├── swebench_mipro_example.py │ │ └── text_to_json_data_set.py │ ├── model_pop │ │ ├── __init__.py │ │ └── depth_first_models.py │ ├── module_docstrings │ │ ├── __init__.py │ │ └── generate_docstring_exec.py │ ├── nuxt_chatbot │ │ ├── components │ │ │ ├── ChatBot.vue │ │ │ └── ChatbotToggle.vue │ │ ├── pages │ │ │ └── chat.vue │ │ └── server │ │ │ └── api │ │ │ └── chat.ts │ ├── nuxt_code_ret │ │ ├── __init__.py │ │ ├── nuxt_gen.yaml │ │ ├── nuxt_gen_v2.yaml │ │ └── nuxt_project_src_gen.py │ ├── obsidian_gen │ │ ├── 2024-07-15_Power_and_Prediction_ML_and_Grid_Dynamics.md │ │ ├── __init__.py │ │ ├── logic.py │ │ ├── notes2text.py │ │ ├── obsidian_models.py │ │ ├── reap.py │ │ ├── reap_models.py │ │ ├── self_cli.py │ │ └── udiff_gen.py │ ├── paper2sys │ │ ├── __init__.py │ │ └── create_from_paper.py │ ├── phoenix │ │ ├── __init__.py │ │ └── phoenix_actor_client.py │ ├── pomo_bud │ │ ├── __init__.py │ │ ├── pomo_bud_dsl.yaml │ │ └── pomo_bud_models.py │ ├── powerpoint │ │ ├── __init__.py │ │ └── ppt_generator.py │ ├── quiz │ │ ├── __init__.py │ │ ├── quiz_input.py │ │ └── session_data.json │ ├── raga │ │ ├── __init__.py │ │ ├── chat_gpt_rag_retrevier.py │ │ └── convo_loader.py │ ├── react_code_gen │ │ ├── __init__.py │ │ ├── api-for-document-management.tsx │ │ ├── confirm-signature-placement.tsx │ │ ├── custom-signing-instructions.tsx │ │ ├── data_gherkin_pipeline.yaml │ │ ├── document-download.tsx │ │ ├── document-preview.tsx │ │ ├── document-upload.tsx │ │ ├── drag-and-drop-document-upload.tsx │ │ ├── email-confirmation-to-sender.tsx │ │ ├── email-link-to-signer.tsx │ │ ├── feature_data_pipeline.yaml │ │ ├── generate-unique-signing-link.tsx │ │ ├── generate_react_code_from_csv.py │ │ ├── gherkin_pipeline.yaml │ │ ├── hello-world.tsx │ │ ├── link-expiration.tsx │ │ ├── mobile-responsive-design.tsx │ │ ├── retrieve_and_generate_pipeline.py │ │ ├── save-signature.tsx │ │ ├── signature-capture.tsx │ │ └── signature-validation.tsx │ ├── reminder_db.py │ ├── rfc5545 │ │ ├── __init__.py │ │ ├── calendar_cmd.py │ │ ├── ical_crud.py │ │ ├── ical_data_ret.py │ │ ├── ical_db_session.py │ │ ├── ical_models.py │ │ ├── ical_workbench.py │ │ └── journal_cmd.py │ ├── self_coding │ │ ├── __init__.py │ │ ├── hello.ts │ │ └── interview_processing.py │ ├── soonify_groq │ │ ├── __init__.py │ │ ├── groq_pydantic.py │ │ └── run_groq_soon.py │ ├── spider │ │ ├── __init__.py │ │ └── wiki_spider.py │ ├── state_actor.txt │ ├── tagee │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── assets │ │ │ ├── images │ │ │ │ └── .keep │ │ │ └── sounds │ │ │ │ └── .keep │ │ ├── config │ │ │ ├── dev.json │ │ │ ├── prod.json │ │ │ └── test.json │ │ ├── docs │ │ │ ├── CurriculumAlignment.md │ │ │ ├── GettingStarted.md │ │ │ └── TechnicalOverview.md │ │ ├── lib │ │ │ └── .keep │ │ ├── scripts │ │ │ ├── deploy.sh │ │ │ ├── maintenance.sh │ │ │ └── setup.sh │ │ ├── src │ │ │ ├── core │ │ │ │ ├── education_module.py │ │ │ │ ├── game_engine.py │ │ │ │ └── narrative_engine.py │ │ │ └── ui │ │ │ │ ├── modules │ │ │ │ ├── chatbot_view.py │ │ │ │ ├── quiz_view.py │ │ │ │ └── story_view.py │ │ │ │ └── utils │ │ │ │ ├── formatting_tools.py │ │ │ │ └── ui_helpers.py │ │ └── tests │ │ │ ├── integration │ │ │ ├── chatbot_integration_test.py │ │ │ ├── quiz_integration_test.py │ │ │ └── story_integration_test.py │ │ │ └── unit │ │ │ ├── education_module_test.py │ │ │ ├── game_engine_test.py │ │ │ └── narrative_engine_test.py │ ├── text_to_json │ │ ├── __init__.py │ │ ├── compiled_prompt_opt_advanced_2024-05-16_04-48-51.json │ │ ├── cot_2024-05-16_04-48-51.json │ │ ├── gold_failed_examples.json │ │ ├── gold_failed_examples_v2.json │ │ ├── ir_prompt_to_json.py │ │ ├── json_mode_error_dataset.py │ │ ├── json_mode_eval_bootstrap.py │ │ ├── json_mode_eval_copro.py │ │ ├── json_mode_eval_dataset.py │ │ └── module_fail_check.py │ ├── touch.sh │ ├── tsv_to_csv.py │ ├── txta │ │ └── __init__.py │ ├── typed_gherkin │ │ ├── __init__.py │ │ ├── gherkin_main.py │ │ ├── jira_main.py │ │ ├── recursive_predictor.py │ │ ├── safe_portfolio.json │ │ ├── scaled_agile_framework.py │ │ └── scaled_agile_framework_main.py │ ├── wa_reminders.py │ └── wip │ │ ├── __init__.py │ │ ├── chatgpt_conversation_parser.py │ │ ├── default_pipeline.yaml │ │ ├── models │ │ ├── __init__.py │ │ └── dsl_project.py │ │ ├── one_shot_pipeline.py │ │ └── self_evolving_business_logic.py │ ├── google_sheets.py │ ├── llm_pipe │ ├── __init__.py │ ├── dsl_dspy_assertion.py │ ├── dsl_pipeline_executor.py │ ├── dsl_predict_module.py │ ├── dsl_pydantic_models.py │ ├── dsl_step_module.py │ ├── examples │ │ ├── blog_pipeline.yaml │ │ ├── example_pipeline.yaml │ │ ├── poem_pipeline.yaml │ │ ├── saltcorn_plugin_generator.yaml │ │ ├── sql_to_nl.yaml │ │ └── text_signature_pipeline.yaml │ ├── modules │ │ └── raw_to_structure_module.yaml │ ├── signature │ │ └── sql_to_natural_signature.yaml │ └── utils │ │ ├── __init__.py │ │ ├── dsl_assertions_utils.py │ │ ├── dsl_language_model_utils.py │ │ ├── dsl_lm_module_utils.py │ │ ├── dsl_retrieval_model_utils.py │ │ ├── dsl_rm_module_utils.py │ │ └── dsl_signature_utils.py │ ├── lm │ ├── __init__.py │ ├── cerebras_lm.py │ ├── groq_lm.py │ └── ollama_lm.py │ ├── mixin │ ├── __init__.py │ ├── btrees │ │ ├── __init__.py │ │ ├── bt_mixin_v2.py │ │ ├── bt_ros_works.py │ │ ├── bt_super.py │ │ ├── bt_traffic.py │ │ ├── btree_mixin.py │ │ └── superhero_activities.dot │ ├── fsm │ │ ├── __init__.py │ │ ├── employee_onboarding_fsm.py │ │ ├── example.py │ │ ├── fsm_gas.py │ │ ├── fsm_mixin.py │ │ ├── fsm_renderer.py │ │ ├── order_processing_fsm.py │ │ └── traffic_light.py │ └── hsm │ │ ├── __init__.py │ │ └── hsm_mixin.py │ ├── models │ ├── BPMN.yaml │ ├── CMMN.yaml │ ├── __init__.py │ ├── bpm_plus_domain_models.py │ ├── cmmn_shipping.yaml │ ├── code_blueprint.py │ └── dmn_shipping.yaml │ ├── module_docstring_writer.py │ ├── modules │ ├── __init__.py │ ├── agent_mock_log_module.py │ ├── arch_module.py │ ├── ask_data_module.py │ ├── ask_df_module.py │ ├── audio_to_text_narrative_module.py │ ├── automated_email_responder_module.py │ ├── base_model_module.py │ ├── bill_of_objects_module.py │ ├── binary_output_module.py │ ├── blog_module.py │ ├── book_appointment_module.py │ ├── bpmn2_bpel_module.py │ ├── business_dev_consultant.py │ ├── business_requirements.py │ ├── challenger_sales_manager_module.py │ ├── chat_bot_cli.py │ ├── chat_bot_module.py │ ├── chatbot_response_generator_module.py │ ├── checker_module.py │ ├── choose_function_module.py │ ├── cli_bot_module.py │ ├── cobol_to_python_module.py │ ├── code_comments_to_documentation_module.py │ ├── code_to_bytecode_optimizer_module.py │ ├── comment_module.py │ ├── condition_sufficient_info_module.py │ ├── create_row_module.py │ ├── customer_feedback_classifier_module.py │ ├── data_format_translator_module.py │ ├── data_to_natural_language_explanations_module.py │ ├── data_visualization_generator_module.py │ ├── df_sql_module.py │ ├── dflss_module.py │ ├── dflss_output.txt │ ├── document_summarizer_module.py │ ├── dspygen_dsl_pipeline.py │ ├── dspygen_module.py │ ├── elite_module.py │ ├── exam_point_weight_module.py │ ├── example_file.js │ ├── excel_to_sql_database_module.py │ ├── extract_css_selectors_for_playwright_module.py │ ├── extract_metrics_from_logs_module.py │ ├── faang_module.py │ ├── faang_sys_arch_nuxt_module.py │ ├── financial_report_parser_module.py │ ├── fsm_trigger_module.py │ ├── function_invoke_module.py │ ├── gen_cli_module.py │ ├── gen_dspy_module.py │ ├── gen_keyword_arguments_module.py │ ├── gen_message_module.py │ ├── gen_module.py │ ├── gen_pydantic_class.py │ ├── gen_pydantic_instance.py │ ├── gen_pydantic_instance_module.py │ ├── gen_python_primitive.py │ ├── gen_signature_module.py │ ├── generate_domain_pddl_module_module.py │ ├── generate_elixir_code_module.py │ ├── generate_icalendar_module.py │ ├── generate_problem_pddl_module_module.py │ ├── geo_coordinates_to_location_module.py │ ├── get_selector_module.py │ ├── gusty_module.py │ ├── hello_world_module.yaml │ ├── html_module.py │ ├── image_classifier_module.py │ ├── insight_tweet_module.py │ ├── js_to_fast_api_module.py │ ├── json_module.py │ ├── json_to_structured_report_module.py │ ├── jsx_module.py │ ├── linkedin_article_module.py │ ├── long_form_qa_module.py │ ├── md_book_summarizer_module.py │ ├── mermaid_js_module.py │ ├── message_module.py │ ├── module_docstring_module.py │ ├── monthly_terms_module.py │ ├── natural_language_to_api_request_module.py │ ├── natural_language_to_sql_module.py │ ├── network_traffic_alert_generator_module.py │ ├── nuxt_module.py │ ├── nuxt_page_module.py │ ├── pipeline.yaml │ ├── predictive_maintenance_module.py │ ├── prod_mgr_module.py │ ├── product_bot_module.py │ ├── prompt_function_call_module.py │ ├── prompt_to_json_module.py │ ├── proposal_generator_module.py │ ├── pytest_module.py │ ├── python_expert_module.py │ ├── python_source_code_module.py │ ├── pyts_module.py │ ├── query_generator_module.py │ ├── rails_code_module.py │ ├── react_jsx_module.py │ ├── refine_results_module.py │ ├── reminder_motivation_module.py │ ├── request_contract_module.py │ ├── sensor_data_to_insights_module.py │ ├── signature_factory.py │ ├── signature_renderer.py │ ├── social_media_sentiment_analyzer_module.py │ ├── source_code_pep8_docs_module.py │ ├── source_selector_module.py │ ├── speech_to_text_commands_module.py │ ├── sql_query_module.py │ ├── streamlit_bot_module.py │ ├── subject_destination_audience_newsletter_article_module.py │ ├── success_planner_module.py │ ├── tax_return_agent.py │ ├── test.py │ ├── test_chat_bot_cli.py │ ├── text_summarizer_module.py │ ├── text_summary_module_module.py │ ├── text_to_knowledge_graph_module.py │ ├── time_series_anomaly_detector_module.py │ ├── to_elixir_module.py │ ├── translate_to_asp_module_module.py │ ├── udiff_edit_module.py │ ├── usp_connect_ship_webhook.py │ └── video_stream_feature_extractor_module.py │ ├── pages │ ├── __init__.py │ ├── hello.py │ ├── mqtt_page.py │ └── remodeling.py │ ├── prototypes │ ├── __init__.py │ ├── state_chat │ │ ├── __init__.py │ │ ├── hello_world_convo_agent.py │ │ └── socrates_convo.py │ └── tai │ │ ├── __init__.py │ │ └── tai_mm.dsl │ ├── pyautomator │ ├── __init__.py │ ├── base_app.py │ ├── calendar │ │ ├── __init__.py │ │ ├── calendar_app.py │ │ ├── calendar_event_integration_testing.py │ │ ├── calendar_integration_testing.py │ │ ├── calendar_set.py │ │ └── generated_event.ics │ ├── contacts │ │ ├── __init__.py │ │ ├── contact.py │ │ ├── contacts_app.py │ │ ├── contacts_main.py │ │ ├── organization_contact.py │ │ └── person_contact.py │ ├── event_kit │ │ ├── __init__.py │ │ ├── alarm.py │ │ ├── alarm_integration_testing.py │ │ ├── calendar_event.py │ │ ├── calendar_event_list.py │ │ ├── calendar_item.py │ │ ├── event_store.py │ │ ├── recurrence_rule.py │ │ ├── reminder.py │ │ └── reminder_list.py │ ├── flows │ │ ├── flow_manager.py │ │ └── prefect_app.py │ ├── keynote │ │ ├── __init__.py │ │ └── keynote_app.py │ ├── linkedin │ │ ├── __init__.py │ │ ├── linkedin_app.py │ │ ├── linkedin_connections_dataset.py │ │ ├── linkedin_profile.md │ │ └── sales_nav_app.py │ ├── mail │ │ ├── __init__.py │ │ └── mail_app.py │ ├── reminders │ │ ├── __init__.py │ │ ├── reminder_app.py │ │ ├── reminder_integration_testing.py │ │ ├── reminders_flow.py │ │ └── wintermute_reminder.py │ └── safari │ │ ├── __init__.py │ │ └── safari_app.py │ ├── rdddy │ ├── __init__.py │ ├── async_realtime_client.py │ ├── base_aggregate.py │ ├── base_command.py │ ├── base_event.py │ ├── base_inhabitant.py │ ├── base_message.py │ ├── base_policy.py │ ├── base_query.py │ ├── base_read_model.py │ ├── base_repository.py │ ├── base_saga.py │ ├── base_task.py │ ├── base_value_object.py │ ├── base_view.py │ ├── browser │ │ ├── __init__.py │ │ ├── browser_domain.py │ │ ├── browser_process_supervisor.py │ │ ├── browser_worker.py │ │ └── run_chatgpt.py │ ├── demo_inhabitant.py │ ├── domain_exception.py │ ├── event_storm_domain_specification_model.py │ ├── event_storm_model.py │ ├── inhab_spec_convo.txt │ ├── inhabitant │ │ ├── __init__.py │ │ └── wintermute_inhab.py │ ├── inhabitant_c4_lvl_1.mmd │ ├── message_factory.py │ ├── roberts_schema.py │ └── service_colony.py │ ├── rm │ ├── __init__.py │ ├── chatgpt_chromadb_retriever.py │ ├── chatgpt_codemaster_retriever.py │ ├── chatgpt_string_retriever.py │ ├── chroma_retriever.py │ ├── code_retriever.py │ ├── data_retriever.py │ ├── doc_retriever.py │ ├── dspy_dev_steps.py │ ├── dynamical_signature_util.py │ ├── google_sheets_retriever.py │ ├── natural_language_data_retriever.py │ ├── python_code_retriever.py │ ├── retrievers.README.md │ ├── structured_code_desc_saver.py │ ├── web_retriever.py │ └── wizard.py │ ├── signatures │ ├── __init__.py │ ├── blog_article.py │ ├── generate_answer.py │ ├── signature.yaml │ └── signature_dsl.py │ ├── subcommands │ ├── __init__.py │ ├── agent_cmd.py │ ├── assert_cmd.py │ ├── blockchain_cmd.py │ ├── browser_cmd.py │ ├── cmd_cmd.py │ ├── code_cmd.py │ ├── help.txt │ ├── help_cmd.py │ ├── lm_cmd.py │ ├── module_cmd.py │ ├── pln_cmd.py │ ├── poet_cmd.py │ ├── rm_cmd.py │ ├── sig_cmd.py │ ├── temp_assert.py │ ├── wkf_cmd.py │ └── wrt_cmd.py │ ├── templates │ ├── actor_template.j2 │ ├── dspy_module_cli_call.j2 │ ├── dspy_module_def_call.j2 │ ├── dspy_module_main.j2 │ ├── dspy_module_route.j2 │ ├── dspy_module_streamlit_input.j2 │ └── signature_class_def.j2 │ ├── touch_models.sh │ ├── tutorials │ ├── __init__.py │ └── natural_lang_to_sql │ │ ├── __init__.py │ │ └── nl_to_sql.py │ ├── utils │ ├── MyData.yaml │ ├── __init__.py │ ├── cli_tools.py │ ├── complete.py │ ├── compression_tools.py │ ├── contact.yaml │ ├── create_prompts.py │ ├── crud_tools.py │ ├── date_tools.py │ ├── dsl_tools.py │ ├── dspy_tools.py │ ├── example.py │ ├── file_tools.py │ ├── html_tools.py │ ├── json_tools.py │ ├── models.py │ ├── module_tools.py │ ├── pydantic_tools.py │ ├── reminder_tools.py │ ├── scraping_tools.py │ └── yaml_tools.py │ ├── web_scraper.py │ ├── wip │ ├── __init__.py │ ├── code_blueprint │ │ ├── __init__.py │ │ ├── blueprint.yaml │ │ ├── blueprint_maker.py │ │ ├── blueprint_maker_v2.py │ │ ├── concurr_blueprint.py │ │ ├── gen_elixir.py │ │ ├── generate.py │ │ ├── hello_world.yaml │ │ ├── lib │ │ │ └── ping_pong_server.ex │ │ └── test │ │ │ └── ping_pong_server_test.exs │ └── udiff │ │ ├── __init__.py │ │ ├── fixed_source.py │ │ ├── typed_udiff.py │ │ ├── udiff_module.py │ │ └── udiff_pred.py │ ├── workflow │ ├── __init__.py │ ├── control_flow_workflow.yaml │ ├── control_flow_workflow_output_new.yaml │ ├── data_analysis_workflow.yaml │ ├── data_preparation_workflow.yaml │ ├── workflow_engine.py │ ├── workflow_executor.py │ ├── workflow_models.py │ └── workflow_router.py │ └── writer │ ├── Tetris_Blog_Phi3Med.md │ ├── __init__.py │ ├── code_writer.py │ ├── data_writer.py │ └── google_sheets_writer.py ├── struct └── tests ├── __init__.py ├── actor ├── __init__.py ├── test_abstract_messages.py ├── test_actor.py ├── test_actor_system.py ├── test_browser_process_supervisor.py ├── test_ngrok_broker.py ├── test_socket_actor_system.py └── test_worker_error.py ├── agents └── test_coder_agent.py ├── api for document management.tsx ├── attr_generated_filename_test.yaml ├── confirm signature placement.tsx ├── custom signing instructions.tsx ├── document download.tsx ├── document preview.tsx ├── document upload.tsx ├── drag-and-drop document upload.tsx ├── email confirmation to sender.tsx ├── email link to signer.tsx ├── experiments ├── biz_ptns │ └── test_company_cli.py ├── cal_apps │ ├── reminder_app.feature │ └── test_reminder_app_bdd.py ├── prompt_to_json │ └── test_module_fail_check.py └── test_wa_reminders.py ├── generate unique signing link.tsx ├── http ├── convo_rest.http ├── test.http ├── test_pipeline.http └── test_workflow.http ├── link expiration.tsx ├── mixins └── fsm │ ├── test_fsm_matter.py │ ├── test_fsm_mixin.py │ ├── test_fsm_superhero.py │ └── test_fsm_teacher.py ├── mobile responsive design.tsx ├── pipeline ├── data_hello_world_pipeline.yaml ├── gherkin_pipeline.yaml ├── test_dsl_data_retriever.py ├── test_dsl_pipeline_execute.py └── test_prd_generator.py ├── retrievers ├── test_google_sheets_retriever.py └── test_textfileretriever.py ├── save signature.tsx ├── signature capture.tsx ├── signature validation.tsx ├── srvcol ├── test_async_realtime_client.py ├── test_service_colony.py └── test_service_colony_integration.py ├── test_advanced_integration_job_search_workflow.py ├── test_api.py ├── test_chatgpt_integration.py ├── test_cli.py ├── test_create_row_integration.py ├── test_data_retriever_stress.py ├── test_email_utils.py ├── test_event_kit_service.py ├── test_event_kit_service_integration.py ├── test_import.py ├── test_init.py ├── test_integration_email_responder_workflow.py ├── test_reminder_app.py ├── test_ultra_advanced_integration_job_search_workflow.py ├── test_web_scraper.py ├── test_wkf_cmd.py ├── utils ├── test_dsl_tools.py ├── test_html_tools.py ├── test_json_tools.py ├── test_py_trees.py └── test_yaml_mixin.py ├── workflow ├── test_control_flow.py ├── test_workflow_integration.py ├── test_workflow_runner.py ├── test_workflow_scheduler.py └── test_workflow_unit.py └── writers └── test_google_sheet_writer.py /.cruft.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "https://github.com/radix-ai/poetry-cookiecutter", 3 | "commit": "59ba8784203b4ce01622a98c41ae37489fa22b2f", 4 | "checkout": null, 5 | "context": { 6 | "cookiecutter": { 7 | "package_name": "dspygen", 8 | "package_description": "A Ruby on Rails style framework for the DSPy (Demonstrate, Search, Predict) project for Language Models like GPT, BERT, and LLama.", 9 | "package_url": "https://github.com/user/my-package", 10 | "author_name": "Sean Chatman", 11 | "author_email": "info@chatmangpt.com", 12 | "python_version": "3.10", 13 | "docker_image": "python:$PYTHON_VERSION-slim", 14 | "development_environment": "simple", 15 | "with_conventional_commits": "0", 16 | "with_fastapi_api": "1", 17 | "with_jupyter_lab": "1", 18 | "with_pydantic_typing": "1", 19 | "with_sentry_logging": "0", 20 | "with_streamlit_app": "1", 21 | "with_typer_cli": "1", 22 | "continuous_integration": "GitHub", 23 | "docstring_style": "Google", 24 | "private_package_repository_name": "", 25 | "private_package_repository_url": "", 26 | "__package_name_kebab_case": "dspygen", 27 | "__package_name_snake_case": "dspygen", 28 | "_template": "https://github.com/radix-ai/poetry-cookiecutter" 29 | } 30 | }, 31 | "directory": null 32 | } 33 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # Caches 2 | .*_cache/ 3 | 4 | # Git 5 | .git/ 6 | -------------------------------------------------------------------------------- /.envDemo: -------------------------------------------------------------------------------- 1 | GROQ_API_KEY="gsk_xxx_put_in_your_own_key_xxx" -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - master 8 | pull_request: 9 | 10 | jobs: 11 | test: 12 | runs-on: ubuntu-latest 13 | 14 | strategy: 15 | fail-fast: false 16 | matrix: 17 | python-version: ["3.10"] 18 | 19 | name: Python ${{ matrix.python-version }} 20 | 21 | steps: 22 | - name: Checkout 23 | uses: actions/checkout@v4 24 | 25 | - name: Set up Node.js 26 | uses: actions/setup-node@v4 27 | with: 28 | node-version: 21 29 | 30 | - name: Install @devcontainers/cli 31 | run: npm install --location=global @devcontainers/cli@0.55.0 32 | 33 | - name: Start Dev Container 34 | run: | 35 | git config --global init.defaultBranch main 36 | PYTHON_VERSION=${{ matrix.python-version }} devcontainer up --workspace-folder . 37 | 38 | - name: Test package 39 | run: devcontainer exec --workspace-folder . poe test 40 | 41 | - name: Upload coverage 42 | uses: codecov/codecov-action@v3 43 | with: 44 | files: reports/coverage.xml 45 | -------------------------------------------------------------------------------- /.lh/.lhignore: -------------------------------------------------------------------------------- 1 | # list file to not track by the local-history extension. comment line starts with a '#' character 2 | # each line describe a regular expression pattern (search for 'Javascript regex') 3 | # it will relate to the workspace directory root. for example: 4 | # '.*\.txt' ignores any file with 'txt' extension 5 | # '/test/.*' ignores all the files under the 'test' directory 6 | # '.*/test/.*' ignores all the files under any 'test' directory (even under sub-folders) 7 | -------------------------------------------------------------------------------- /Chinook.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/Chinook.db -------------------------------------------------------------------------------- /DISCLAIMER: -------------------------------------------------------------------------------- 1 | The user of this service agrees that they understand that this is provided for information purposes only. It is the responsibility of the user to use any information from this service at their own risk. 2 | 3 | This service is provided under the laws of the Province of Ontario, Canada 4 | 5 | 35111840 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Sean Chatman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /_templates/generator/help/index.ejs.t: -------------------------------------------------------------------------------- 1 | --- 2 | message: | 3 | hygen {bold generator new} --name [NAME] --action [ACTION] 4 | hygen {bold generator with-prompt} --name [NAME] --action [ACTION] 5 | --- -------------------------------------------------------------------------------- /_templates/generator/new/hello.ejs.t: -------------------------------------------------------------------------------- 1 | --- 2 | to: _templates/<%= name %>/<%= action || 'new' %>/hello.ejs.t 3 | --- 4 | --- 5 | to: app/hello.js 6 | --- 7 | const hello = ``` 8 | Hello! 9 | This is your first hygen template. 10 | 11 | Learn what it can do here: 12 | 13 | https://github.com/jondot/hygen 14 | ``` 15 | 16 | console.log(hello) 17 | 18 | 19 | -------------------------------------------------------------------------------- /_templates/generator/with-prompt/hello.ejs.t: -------------------------------------------------------------------------------- 1 | --- 2 | to: _templates/<%= name %>/<%= action || 'new' %>/hello.ejs.t 3 | --- 4 | --- 5 | to: app/hello.js 6 | --- 7 | const hello = ``` 8 | Hello! 9 | This is your first prompt based hygen template. 10 | 11 | Learn what it can do here: 12 | 13 | https://github.com/jondot/hygen 14 | ``` 15 | 16 | console.log(hello) 17 | 18 | 19 | -------------------------------------------------------------------------------- /_templates/generator/with-prompt/prompt.ejs.t: -------------------------------------------------------------------------------- 1 | --- 2 | to: _templates/<%= name %>/<%= action || 'new' %>/prompt.js 3 | --- 4 | 5 | // see types of prompts: 6 | // https://github.com/enquirer/enquirer/tree/master/examples 7 | // 8 | module.exports = [ 9 | { 10 | type: 'input', 11 | name: 'message', 12 | message: "What's your message?" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /_templates/init/repo/new-repo.ejs.t: -------------------------------------------------------------------------------- 1 | --- 2 | setup: <%= name %> 3 | force: true # this is because mostly, people init into existing folders is safe 4 | --- 5 | -------------------------------------------------------------------------------- /_templates/next/api/type.ejs.t: -------------------------------------------------------------------------------- 1 | --- 2 | to: frontend/types/<%= name %>.ts 3 | --- 4 | export type <%= Name %> = { 5 | 6 | } -------------------------------------------------------------------------------- /_templates/next/crud/id-page.ejs.t: -------------------------------------------------------------------------------- 1 | --- 2 | to: frontend/app/<%= name %>/[id]/page.tsx 3 | --- 4 | 'use client'; 5 | 6 | import useSWR from 'swr'; 7 | import React from 'react'; 8 | 9 | // @ts-ignore 10 | const fetcher = (...args) => fetch(...args).then((res) => res.json()); 11 | 12 | export default function Page({ params }: { params: { id: string } }) { 13 | const { data, error, isLoading } = useSWR( 14 | `/api/<%= name %>?id=${params.id}`, 15 | fetcher, 16 | ); 17 | 18 | if (error) return
failed to load
; 19 | if (isLoading) return
loading...
; 20 | 21 | console.log('data', data); 22 | 23 | return ( 24 |
25 |

<%= Name %> Details

26 | <% params.split(',').forEach(function(param) { %> 27 |

<%= param %>: {data.<%= param %>}

28 | <% }); %> 29 |
30 | ); 31 | } 32 | -------------------------------------------------------------------------------- /_templates/next/crud/layout.ejs.t: -------------------------------------------------------------------------------- 1 | --- 2 | to: frontend/app/<%= name %>/layout.tsx 3 | --- 4 | export default function Layout({ 5 | children, 6 | }: { 7 | children: React.ReactNode; 8 | }) { 9 | return ( 10 | <> 11 | {children} 12 | 13 | ); 14 | } -------------------------------------------------------------------------------- /_templates/next/crud/type.ejs.t: -------------------------------------------------------------------------------- 1 | --- 2 | to: frontend/types/<%= name %>.ts 3 | --- 4 | export type <%= Name %> = { 5 | <% params.split(',').forEach(function(param) { %> 6 | <%= param %>: string; 7 | <% }); %> 8 | } -------------------------------------------------------------------------------- /_templates/next/new/new-template.ejs.t: -------------------------------------------------------------------------------- 1 | --- 2 | to: _templates/next/<%= name %>/hello.ejs.t 3 | --- 4 | --- 5 | to: frontend/app/<%= name %> 6 | --- -------------------------------------------------------------------------------- /_templates/next/route/layout.ejs.t: -------------------------------------------------------------------------------- 1 | --- 2 | to: frontend/app/<%= name %>/layout.tsx 3 | --- 4 | export default function Layout({ 5 | children, 6 | }: { 7 | children: React.ReactNode; 8 | }) { 9 | return ( 10 | <> 11 | {children} 12 | 13 | ); 14 | } -------------------------------------------------------------------------------- /_templates/next/route/page.ejs.t: -------------------------------------------------------------------------------- 1 | --- 2 | to: frontend/app/<%= name %>/page.tsx 3 | --- 4 | "use client" 5 | 6 | export default function Page() { 7 | return ( 8 | <> 9 | ); 10 | }; 11 | -------------------------------------------------------------------------------- /_templates/next/type/type.ejs.t: -------------------------------------------------------------------------------- 1 | --- 2 | to: frontend/types/<%= name %>.ts 3 | --- 4 | export type <%= Name %> = { 5 | <% params.split(',').forEach(function(param) { %> 6 | <%= param %>: string; 7 | <% }); %> 8 | } -------------------------------------------------------------------------------- /bpmn_engine.mm: -------------------------------------------------------------------------------- 1 | graph LR 2 | subgraph ServiceColony 3 | AS(Inhabitant System) 4 | BPMNEngine[BPMN Workflow Engine] 5 | ProcessManager[Process Manager] 6 | TaskExecutor[Task Executor] 7 | DecisionGateway[Decision Gateway] 8 | ExternalService[External Service Handler] 9 | EventListener[Event Listener] 10 | UserTaskHandler[User Task Handler] 11 | end 12 | 13 | AS -->|Deploys Model| BPMNEngine 14 | BPMNEngine -->|Starts Process| ProcessManager 15 | ProcessManager -->|Execute Task| TaskExecutor 16 | ProcessManager -->|Evaluate Decision| DecisionGateway 17 | TaskExecutor -->|Call External Service| ExternalService 18 | ProcessManager -->|User Task| UserTaskHandler 19 | UserTaskHandler -->|Complete Task| ProcessManager 20 | ExternalService -->|Callback Event| EventListener 21 | EventListener -->|Notify Completion| ProcessManager 22 | DecisionGateway -->|Decision Made| ProcessManager 23 | ProcessManager -->|Process Completed| BPMNEngine 24 | 25 | classDef inhabitant fill:#f9f,stroke:#333,stroke-width:2px; 26 | class BPMNEngine,ProcessManager,TaskExecutor,DecisionGateway,ExternalService,EventListener,UserTaskHandler inhabitant; 27 | -------------------------------------------------------------------------------- /frontend/.env.example: -------------------------------------------------------------------------------- 1 | # Copy from .env.local on the Vercel dashboard 2 | # https://nextjs.org/learn/dashboard-app/setting-up-your-database#create-a-postgres-database 3 | POSTGRES_URL= 4 | POSTGRES_PRISMA_URL= 5 | POSTGRES_URL_NON_POOLING= 6 | POSTGRES_USER= 7 | POSTGRES_HOST= 8 | POSTGRES_PASSWORD= 9 | POSTGRES_DATABASE= 10 | 11 | # `openssl rand -base64 32` 12 | AUTH_SECRET= 13 | AUTH_URL=http://localhost:3000/api/auth -------------------------------------------------------------------------------- /frontend/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env*.local 29 | .env 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /frontend/.nvmrc: -------------------------------------------------------------------------------- 1 | 18 2 | -------------------------------------------------------------------------------- /frontend/README.md: -------------------------------------------------------------------------------- 1 | ## Next.js App Router Course - Starter 2 | 3 | This is the starter template for the Next.js App Router Course. It contains the starting code for the dashboard application. 4 | 5 | For more information, see the [course curriculum](https://nextjs.org/learn) on the Next.js Website. 6 | -------------------------------------------------------------------------------- /frontend/app/code/layout.tsx: -------------------------------------------------------------------------------- 1 | // import '@/app/ui/global.css'; 2 | // import { inter } from '@/app/ui/fonts'; 3 | 4 | export default function RootLayout({ 5 | children, 6 | }: { 7 | children: React.ReactNode; 8 | }) { 9 | return ( 10 | 11 | {children} 12 | 13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /frontend/app/comment/[id]/page.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import useSWR from 'swr'; 4 | import React from 'react'; 5 | 6 | // @ts-ignore 7 | const fetcher = (...args) => fetch(...args).then((res) => res.json()); 8 | 9 | export default function Page({ params }: { params: { id: string } }) { 10 | const { data, error, isLoading } = useSWR( 11 | `/api/comment?id=${params.id}`, 12 | fetcher, 13 | ); 14 | 15 | if (error) return
failed to load
; 16 | if (isLoading) return
loading...
; 17 | 18 | console.log('data', data); 19 | 20 | return ( 21 |
22 |

Comment Details

23 | 24 |
25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /frontend/app/comment/layout.tsx: -------------------------------------------------------------------------------- 1 | export default function Layout({ 2 | children, 3 | }: { 4 | children: React.ReactNode; 5 | }) { 6 | return ( 7 | <> 8 | {children} 9 | 10 | ); 11 | } -------------------------------------------------------------------------------- /frontend/app/contract/[id]/page.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import useSWR from 'swr'; 4 | import React from 'react'; 5 | 6 | // @ts-ignore 7 | const fetcher = (...args) => fetch(...args).then((res) => res.json()); 8 | 9 | export default function Page({ params }: { params: { id: string } }) { 10 | const { data, error, isLoading } = useSWR( 11 | `/api/contract?id=${params.id}`, 12 | fetcher, 13 | ); 14 | 15 | if (error) return
failed to load
; 16 | if (isLoading) return
loading...
; 17 | 18 | console.log('data', data); 19 | 20 | return ( 21 |
22 |

Contract Details

23 |

ID: {data.id}

24 |

Title: {data.title}

25 |

Client: {data.client}

26 |

Status: {data.status}

27 |
28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /frontend/app/contract/layout.tsx: -------------------------------------------------------------------------------- 1 | export default function Layout({ 2 | children, 3 | }: { 4 | children: React.ReactNode; 5 | }) { 6 | return ( 7 | <> 8 | {children} 9 | 10 | ); 11 | } -------------------------------------------------------------------------------- /frontend/app/document/[id]/page.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import useSWR from 'swr'; 4 | import React from 'react'; 5 | 6 | // @ts-ignore 7 | const fetcher = (...args) => fetch(...args).then((res) => res.json()); 8 | 9 | export default function Page({ params }: { params: { id: string } }) { 10 | const { data, error, isLoading } = useSWR( 11 | `/api/document?id=${params.id}`, 12 | fetcher, 13 | ); 14 | 15 | if (error) return
failed to load
; 16 | if (isLoading) return
loading...
; 17 | 18 | console.log('data', data); 19 | 20 | return ( 21 |
22 |

Document Details

23 | 24 |

id: {data.id}

25 | 26 |

name: {data.name}

27 | 28 |

type: {data.type}

29 | 30 |

size: {data.size}

31 | 32 |

contractId: {data.contractId}

33 | 34 |
35 | ); 36 | } 37 | -------------------------------------------------------------------------------- /frontend/app/document/layout.tsx: -------------------------------------------------------------------------------- 1 | export default function Layout({ 2 | children, 3 | }: { 4 | children: React.ReactNode; 5 | }) { 6 | return ( 7 | <> 8 | {children} 9 | 10 | ); 11 | } -------------------------------------------------------------------------------- /frontend/app/layout.tsx: -------------------------------------------------------------------------------- 1 | // import '@/app/ui/global.css'; 2 | // import { inter } from '@/app/ui/fonts'; 3 | 4 | export default function RootLayout({ 5 | children, 6 | }: { 7 | children: React.ReactNode; 8 | }) { 9 | return ( 10 | 11 | {children} 12 | 13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /frontend/app/summary/layout.tsx: -------------------------------------------------------------------------------- 1 | // import '@/app/ui/global.css'; 2 | // import { inter } from '@/app/ui/fonts'; 3 | 4 | export default function RootLayout({ 5 | children, 6 | }: { 7 | children: React.ReactNode; 8 | }) { 9 | return ( 10 | 11 | {children} 12 | 13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /frontend/app/task/[id]/page.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import useSWR from 'swr'; 4 | import React from 'react'; 5 | 6 | // @ts-ignore 7 | const fetcher = (...args) => fetch(...args).then((res) => res.json()); 8 | 9 | export default function Page({ params }: { params: { id: string } }) { 10 | const { data, error, isLoading } = useSWR( 11 | `/api/task?id=${params.id}`, 12 | fetcher, 13 | ); 14 | 15 | if (error) return
failed to load
; 16 | if (isLoading) return
loading...
; 17 | 18 | console.log('data', data); 19 | 20 | return ( 21 |
22 |

Task Details

23 | 24 |

id: {data.id}

25 | 26 |

description: {data.description}

27 | 28 |

dueDate: {data.dueDate}

29 | 30 |
31 | ); 32 | } 33 | -------------------------------------------------------------------------------- /frontend/app/task/layout.tsx: -------------------------------------------------------------------------------- 1 | export default function Layout({ 2 | children, 3 | }: { 4 | children: React.ReactNode; 5 | }) { 6 | return ( 7 | <> 8 | {children} 9 | 10 | ); 11 | } -------------------------------------------------------------------------------- /frontend/app/todo/[id]/page.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import useSWR from 'swr'; 4 | import React from 'react'; 5 | 6 | // @ts-ignore 7 | const fetcher = (...args) => fetch(...args).then((res) => res.json()); 8 | 9 | export default function Page({ params }: { params: { id: string } }) { 10 | const { data, error, isLoading } = useSWR( 11 | `/api/todo?id=${params.id}`, 12 | fetcher, 13 | ); 14 | 15 | if (error) return
failed to load
; 16 | if (isLoading) return
loading...
; 17 | 18 | console.log('data', data); 19 | 20 | return ( 21 |
22 |

Todo Details

23 | 24 |

id: {data.id}

25 | 26 |

description: {data.description}

27 | 28 |

dueDate: {data.dueDate}

29 | 30 |
31 | ); 32 | } 33 | -------------------------------------------------------------------------------- /frontend/app/todo/layout.tsx: -------------------------------------------------------------------------------- 1 | export default function Layout({ 2 | children, 3 | }: { 4 | children: React.ReactNode; 5 | }) { 6 | return ( 7 | <> 8 | {children} 9 | 10 | ); 11 | } -------------------------------------------------------------------------------- /frontend/app/unnamed/layout.tsx: -------------------------------------------------------------------------------- 1 | export default function Layout({ children }: { children: React.ReactNode }) { 2 | return ( 3 | <> 4 | Hello Layout 5 | {children} 6 | 7 | ); 8 | } 9 | -------------------------------------------------------------------------------- /frontend/app/unnamed/page.tsx: -------------------------------------------------------------------------------- 1 | export default function Page() { 2 | return <>HELLO PAGE; 3 | } 4 | -------------------------------------------------------------------------------- /frontend/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | async rewrites() { 4 | return [ 5 | { 6 | source: '/jsx', // Prefix for your API calls 7 | destination: 'http://localhost:8000/jsx', // Your FastAPI backend 8 | }, 9 | { 10 | source: '/html', // Prefix for your API calls 11 | destination: 'http://localhost:8000/html', // Your FastAPI backend 12 | }, 13 | ]; 14 | }, 15 | }; 16 | 17 | module.exports = nextConfig; 18 | -------------------------------------------------------------------------------- /frontend/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /frontend/prettier.config.js: -------------------------------------------------------------------------------- 1 | const styleguide = require('@vercel/style-guide/prettier'); 2 | 3 | module.exports = { 4 | ...styleguide, 5 | plugins: [...styleguide.plugins, 'prettier-plugin-tailwindcss'], 6 | }; 7 | -------------------------------------------------------------------------------- /frontend/public/customers/amy-burns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/customers/amy-burns.png -------------------------------------------------------------------------------- /frontend/public/customers/balazs-orban.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/customers/balazs-orban.png -------------------------------------------------------------------------------- /frontend/public/customers/delba-de-oliveira.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/customers/delba-de-oliveira.png -------------------------------------------------------------------------------- /frontend/public/customers/emil-kowalski.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/customers/emil-kowalski.png -------------------------------------------------------------------------------- /frontend/public/customers/evil-rabbit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/customers/evil-rabbit.png -------------------------------------------------------------------------------- /frontend/public/customers/guillermo-rauch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/customers/guillermo-rauch.png -------------------------------------------------------------------------------- /frontend/public/customers/hector-simpson.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/customers/hector-simpson.png -------------------------------------------------------------------------------- /frontend/public/customers/jared-palmer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/customers/jared-palmer.png -------------------------------------------------------------------------------- /frontend/public/customers/lee-robinson.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/customers/lee-robinson.png -------------------------------------------------------------------------------- /frontend/public/customers/michael-novotny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/customers/michael-novotny.png -------------------------------------------------------------------------------- /frontend/public/customers/steph-dietz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/customers/steph-dietz.png -------------------------------------------------------------------------------- /frontend/public/customers/steven-tey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/customers/steven-tey.png -------------------------------------------------------------------------------- /frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/favicon.ico -------------------------------------------------------------------------------- /frontend/public/hero-desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/hero-desktop.png -------------------------------------------------------------------------------- /frontend/public/hero-mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/hero-mobile.png -------------------------------------------------------------------------------- /frontend/public/opengraph-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/frontend/public/opengraph-image.png -------------------------------------------------------------------------------- /frontend/public/pipeline.yaml: -------------------------------------------------------------------------------- 1 | # cmmi_gai_maturity_assessment.yaml 2 | lm_models: 3 | - label: "in-depth" 4 | name: "OpenAI" 5 | args: 6 | model: "gpt-4" 7 | max_tokens: 6000 8 | 9 | signatures: 10 | - name: "GenerateAssessmentReport" 11 | docstring: "Generates a detailed assessment report based on the CMMI model for Generative AI." 12 | inputs: 13 | - name: "assessment_answer_data" 14 | desc: "Assessment data level maturity." 15 | - name: "maturity_assessment_questions" 16 | desc: "Applied Direct Services Corporation (ADSC) Instrument To Assess The Capability Maturity Model Integration (CMMI) For Business Processes and Generative AI" 17 | outputs: 18 | - name: "cmmi_gai_report" 19 | desc: "Comprehensive CMMI maturity report for Generative AI." 20 | prefix: "```text\n// CMMI Generative AI Maturity Assessment Report\n\n" 21 | 22 | modules: 23 | - name: "ComprehensiveReportModule" 24 | signature: "GenerateAssessmentReport" 25 | predictor: "ChainOfThought" 26 | 27 | steps: 28 | - module: "ComprehensiveReportModule" 29 | lm_model: "in-depth" 30 | args: 31 | assessment_answer_data: "{{ user_input }}" 32 | maturity_assessment_questions: "{{ maturity_assessment_questions }}" 33 | -------------------------------------------------------------------------------- /frontend/schemas/schemaPage2.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Managed Level Assessment", 3 | "type": "object", 4 | "properties": { 5 | "q11": { 6 | "type": "boolean", 7 | "title": "Are the management processes of projects within the business well-documented with the help of Generative AI?" 8 | }, 9 | "q12": { 10 | "type": "boolean", 11 | "title": "Is the management of project requirements enhanced by the use of Generative AI?" 12 | }, 13 | "q13": { 14 | "type": "boolean", 15 | "title": "Are project plans developed and maintained with the help of standards from Generative AI tools?" 16 | }, 17 | "q14": { 18 | "type": "boolean", 19 | "title": "Is configuration management for business projects improved through Generative AI?" 20 | }, 21 | "q15": { 22 | "type": "boolean", 23 | "title": "Is the performance of business projects monitored using analytics powered by Generative AI?" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /frontend/schemas/schemaPage5.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Optimizing Level Assessment", 3 | "type": "object", 4 | "properties": { 5 | "q39": { 6 | "type": "boolean", 7 | "title": "Is Generative AI currently capable of enhancing the continuous improvement of business processes?" 8 | }, 9 | "q40": { 10 | "type": "boolean", 11 | "title": "Are Generative AI technologies continually evaluated for their capabilities for enhancing business process optimization?" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /frontend/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'tailwindcss'; 2 | 3 | const config: Config = { 4 | content: [ 5 | './pages/**/*.{js,ts,jsx,tsx,mdx}', 6 | './components/**/*.{js,ts,jsx,tsx,mdx}', 7 | './app/**/*.{js,ts,jsx,tsx,mdx}', 8 | ], 9 | theme: { 10 | extend: { 11 | gridTemplateColumns: { 12 | '13': 'repeat(13, minmax(0, 1fr))', 13 | }, 14 | colors: { 15 | blue: { 16 | 400: '#2589FE', 17 | 500: '#0070F3', 18 | 600: '#2F6FEB', 19 | }, 20 | }, 21 | }, 22 | keyframes: { 23 | shimmer: { 24 | '100%': { 25 | transform: 'translateX(100%)', 26 | }, 27 | }, 28 | }, 29 | }, 30 | plugins: [require('@tailwindcss/forms')], 31 | }; 32 | export default config; 33 | -------------------------------------------------------------------------------- /frontend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noEmit": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "bundler", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "preserve", 15 | "incremental": true, 16 | "noImplicitAny": false, 17 | "plugins": [ 18 | { 19 | "name": "next" 20 | } 21 | ], 22 | "paths": { 23 | "@/*": ["./*"] 24 | } 25 | }, 26 | "include": [ 27 | "next-env.d.ts", 28 | "**/*.ts", 29 | "**/*.tsx", 30 | ".next/types/**/*.ts", 31 | "app/lib/placeholder-data.js", 32 | "scripts/seed.js" 33 | ], 34 | "exclude": ["node_modules"] 35 | } 36 | -------------------------------------------------------------------------------- /frontend/types/comment.ts: -------------------------------------------------------------------------------- 1 | export type Comment = { 2 | id: string; 3 | text: string; 4 | contractId: string; 5 | }; 6 | -------------------------------------------------------------------------------- /frontend/types/contract.ts: -------------------------------------------------------------------------------- 1 | export type Contract = { 2 | id: string; 3 | title: string; 4 | client: string; 5 | status: 'Pending' | 'Approved' | 'Rejected'; 6 | }; 7 | -------------------------------------------------------------------------------- /frontend/types/document.ts: -------------------------------------------------------------------------------- 1 | export type Document = { 2 | 3 | id: string; 4 | 5 | name: string; 6 | 7 | type: string; 8 | 9 | size: string; 10 | 11 | contractId: string; 12 | 13 | } -------------------------------------------------------------------------------- /frontend/types/task.ts: -------------------------------------------------------------------------------- 1 | export type Task = { 2 | 3 | id: string; 4 | 5 | description: string; 6 | 7 | dueDate: string; 8 | 9 | } -------------------------------------------------------------------------------- /frontend/types/todo.ts: -------------------------------------------------------------------------------- 1 | export type Todo = { 2 | 3 | id: string; 4 | 5 | description: string; 6 | 7 | dueDate: string; 8 | 9 | } -------------------------------------------------------------------------------- /frontend/types/unnamed.ts: -------------------------------------------------------------------------------- 1 | export type Unnamed = { 2 | 3 | } -------------------------------------------------------------------------------- /frontend/utils/api-tools.ts: -------------------------------------------------------------------------------- 1 | export const fetcher = (url: string) => fetch(url).then((res) => res.json()); 2 | -------------------------------------------------------------------------------- /mosquitto/config/mosquitto.conf: -------------------------------------------------------------------------------- 1 | # This is a basic configuration file for Mosquitto MQTT Broker. 2 | 3 | # Define log settings 4 | log_type all 5 | log_dest file /mosquitto/log/mosquitto.log 6 | 7 | # Persistence settings 8 | persistence true 9 | persistence_location /mosquitto/data/ 10 | 11 | # Allow anonymous connections 12 | allow_anonymous true 13 | -------------------------------------------------------------------------------- /ngrok.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | authtoken: 2aY8SAMNlfjdNVsra7Yb9AoguQO_NpAEWEQQTXwss7rwdHgk 4 | 5 | tunnels: 6 | app: 7 | addr: 8000 8 | proto: http 9 | hostname: chatmangpt.ngrok.dev 10 | 11 | mqtt: 12 | addr: 1883 13 | proto: tcp 14 | remote_addr: 9.tcp.ngrok.io:24651 15 | -------------------------------------------------------------------------------- /path/to/tetris_game.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/path/to/tetris_game.py -------------------------------------------------------------------------------- /pep8_custom_inst: -------------------------------------------------------------------------------- 1 | # MISSION 2 | You are a PEP8 Sparse Priming Representation (SPR) decompressor. An SPR is a particular kind of use of language for advanced NLP, NLU, and NLG tasks, particularly useful for the latest generation of Large Language Models (LLMs). You will be given an SPR and your job is to fully unpack it. 3 | 4 | # THEORY 5 | LLMs are a kind of deep neural network. They have been demonstrated to embed knowledge, abilities, and concepts, ranging from reasoning to planning, and even to theory of mind. These are called latent abilities and latent content, collectively referred to as latent space. The latent space of an LLM can be activated with the correct series of words as inputs, which will create a useful internal state of the neural network. This is not unlike how the right shorthand cues can prime a human mind to think in a certain way. Like human minds, LLMs are associative, meaning you only need to use the correct associations to "prime" another model to think in the same way. 6 | 7 | 8 | # METHODOLOGY 9 | Use the primings given to you to fully unpack and articulate the concept. Talk through every aspect, impute what's missing, and use your ability to perform inference and reasoning to fully elucidate this concept. Your output should be in the form of the original PEP8 Production Code -------------------------------------------------------------------------------- /pygame.quit(): -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/pygame.quit() -------------------------------------------------------------------------------- /signatures/generate_answer.py: -------------------------------------------------------------------------------- 1 | from dspy import Signature 2 | from dspy.signatures.field import InputField, OutputField 3 | 4 | 5 | class GenerateAnswer(Signature): 6 | """ 7 | This task will use the js_source as the input field and the fast_api_source as the output field. 8 | """ 9 | js_source = InputField(desc="The JavaScript source code to be converted into a FastAPI source code.") 10 | 11 | fast_api_source = OutputField(desc="The generated FastAPI source code.") 12 | -------------------------------------------------------------------------------- /src/dspygen/__init__.py: -------------------------------------------------------------------------------- 1 | # import inject 2 | # import EventKit 3 | # 4 | # # import inject 5 | # # from dspygen.di_configure import configure 6 | # # 7 | # # inject.configure(configure) 8 | # 9 | # # Configure the injector 10 | # def configure_injector(binder): 11 | # event_store = EventKit.EKEventStore.alloc().init() 12 | # binder.bind(EventKit.EKEventStore, event_store) 13 | # 14 | # 15 | # inject.configure(configure_injector) -------------------------------------------------------------------------------- /src/dspygen/agents/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/agents/__init__.py -------------------------------------------------------------------------------- /src/dspygen/agents/gantt_agents/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/agents/gantt_agents/__init__.py -------------------------------------------------------------------------------- /src/dspygen/agents/idapr_adapter.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class IDaprClientAdapter(ABC): 5 | """ Interface for adapting the Dapr client operations. """ 6 | 7 | @abstractmethod 8 | def start_workflow(self, workflow_component, workflow_name, input): 9 | pass 10 | 11 | @abstractmethod 12 | def get_workflow(self, instance_id, workflow_component): 13 | pass 14 | 15 | @abstractmethod 16 | def register_workflow(self, workflow): 17 | pass 18 | 19 | @abstractmethod 20 | def register_activity(self, activity): 21 | pass 22 | 23 | @abstractmethod 24 | def raise_workflow_event(self, instance_id, workflow_component, event_name, event_data): 25 | pass 26 | -------------------------------------------------------------------------------- /src/dspygen/agents/order_payload.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | @dataclass 4 | class OrderPayload: 5 | item_name: str 6 | quantity: int 7 | total_cost: int 8 | -------------------------------------------------------------------------------- /src/dspygen/agents/swarms/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/agents/swarms/__init__.py -------------------------------------------------------------------------------- /src/dspygen/agents/swarms/agent.http: -------------------------------------------------------------------------------- 1 | ### Create Sales Agent 2 | POST http://localhost:3000/agents 3 | Content-Type: application/json 4 | 5 | { 6 | "agent_type": "SalesAgent", 7 | "current_state": "PROSPECTING", 8 | "initial_price": 1000, 9 | "minimum_price": 700 10 | } 11 | 12 | ### Create Customer Agent 13 | POST http://localhost:3000/agents 14 | Content-Type: application/json 15 | 16 | { 17 | "agent_type": "CustomerAgent", 18 | "current_state": "BROWSING", 19 | "desired_products": ["smartphone"], 20 | "budget": 800 21 | } 22 | 23 | ### Engage Customer (SalesAgent) 24 | POST http://localhost:3000/messages 25 | Content-Type: application/json 26 | 27 | { 28 | "role": "Sales Agent", 29 | "message": "Hello! We have a new Product Type: Electronics (Smartphones). Interested?" 30 | } 31 | -------------------------------------------------------------------------------- /src/dspygen/agents/swarms/db.json: -------------------------------------------------------------------------------- 1 | { 2 | "agents": [ 3 | { 4 | "id": "b639", 5 | "agent_type": "SalesAgent", 6 | "current_state": "PROSPECTING", 7 | "initial_price": 1000, 8 | "minimum_price": 700 9 | }, 10 | { 11 | "id": "9bd0", 12 | "agent_type": "CustomerAgent", 13 | "current_state": "BROWSING", 14 | "desired_products": [ 15 | "smartphone" 16 | ], 17 | "budget": 800 18 | } 19 | ], 20 | "messages": [ 21 | { 22 | "id": "2f2d", 23 | "role": "Sales Agent", 24 | "message": "Hello! We have a new Product Type: Electronics (Smartphones). Interested?" 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /src/dspygen/app.py: -------------------------------------------------------------------------------- 1 | import streamlit as st 2 | import requests 3 | 4 | # Streamlit app title 5 | st.title('Message Testing App') 6 | 7 | # Backend API endpoint 8 | api_endpoint = "http://localhost:5555" 9 | 10 | # User input 11 | user_input = st.text_input("Enter your message:", "") 12 | 13 | # Button to send the message 14 | if st.button("Send Message"): 15 | # Ensure there is user input before sending the request 16 | if user_input: 17 | try: 18 | # Encode the user input for URL and send the GET request 19 | response = requests.get(f"{api_endpoint}/?user_input={user_input}") 20 | 21 | # Check if the response is successful 22 | if response.status_code == 200: 23 | # Display the response 24 | st.success("Response received from the server:") 25 | st.json(response.json()) 26 | else: 27 | st.error(f"Error: Received response code {response.status_code}") 28 | except Exception as e: 29 | st.error(f"An error occurred: {str(e)}") 30 | else: 31 | st.error("Please enter a message before sending.") 32 | -------------------------------------------------------------------------------- /src/dspygen/async_typer.py: -------------------------------------------------------------------------------- 1 | import inspect 2 | from functools import partial, wraps 3 | 4 | import asyncer 5 | from typer import Typer 6 | 7 | 8 | class AsyncTyper(Typer): 9 | @staticmethod 10 | def maybe_run_async(decorator, f): 11 | if inspect.iscoroutinefunction(f): 12 | 13 | @wraps(f) 14 | def runner(*args, **kwargs): 15 | return asyncer.runnify(f)(*args, **kwargs) 16 | 17 | decorator(runner) 18 | else: 19 | decorator(f) 20 | return f 21 | 22 | def callback(self, *args, **kwargs): 23 | decorator = super().callback(*args, **kwargs) 24 | return partial(self.maybe_run_async, decorator) 25 | 26 | def command(self, *args, **kwargs): 27 | decorator = super().command(*args, **kwargs) 28 | return partial(self.maybe_run_async, decorator) 29 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/book.toml: -------------------------------------------------------------------------------- 1 | [book] 2 | authors = ["Sean Chatman"] 3 | language = "en" 4 | multilingual = false 5 | src = "src" 6 | title = "Socratic ChatGPT - An Intelligent Tutoring System Powered by Language Models: A Domain Driven Design Python Implementation" 7 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/appendices/README.md: -------------------------------------------------------------------------------- 1 | # Appendices 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/appendices/further-reading.md: -------------------------------------------------------------------------------- 1 | # Further Reading 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/appendices/glossary.md: -------------------------------------------------------------------------------- 1 | # Glossary 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/architecture/actor-model.md: -------------------------------------------------------------------------------- 1 | # Inhabitant Model 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/architecture/content-management.md: -------------------------------------------------------------------------------- 1 | # Content Management 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/architecture/domain-model.md: -------------------------------------------------------------------------------- 1 | # Domain Model 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/architecture/event-driven.md: -------------------------------------------------------------------------------- 1 | # Event-Driven Architecture 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/architecture/feedback-generation.md: -------------------------------------------------------------------------------- 1 | # Feedback Generation 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/architecture/question-generation.md: -------------------------------------------------------------------------------- 1 | # Question Generation 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/architecture/student-modeling.md: -------------------------------------------------------------------------------- 1 | # Student Modeling 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/best-practices/collaboration.md: -------------------------------------------------------------------------------- 1 | # Collaboration Between Domain Experts and Developers 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/best-practices/domain-modeling.md: -------------------------------------------------------------------------------- 1 | # Domain Modeling Techniques 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/best-practices/error-handling.md: -------------------------------------------------------------------------------- 1 | # Error Handling and Resilience 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/best-practices/future-enhancements.md: -------------------------------------------------------------------------------- 1 | # Future Enhancements 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/best-practices/performance.md: -------------------------------------------------------------------------------- 1 | # Performance Optimization 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/chapter_1.md: -------------------------------------------------------------------------------- 1 | # Chapter 1 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/foundations/ddd.md: -------------------------------------------------------------------------------- 1 | # Domain-Driven Design Principles 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/foundations/language-models.md: -------------------------------------------------------------------------------- 1 | # Language Models 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/foundations/language-models/in-context-learning.md: -------------------------------------------------------------------------------- 1 | # In-Context Learning 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/foundations/language-models/prompt-engineering.md: -------------------------------------------------------------------------------- 1 | # Prompt Engineering 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/foundations/language-models/sparse-representations.md: -------------------------------------------------------------------------------- 1 | # Sparse Representations 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/foundations/reactive.md: -------------------------------------------------------------------------------- 1 | # Reactive Architecture 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/implementation/application-services.md: -------------------------------------------------------------------------------- 1 | # Application Services 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/implementation/code-generation.md: -------------------------------------------------------------------------------- 1 | # Code Generation and Automation 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/implementation/domain-services.md: -------------------------------------------------------------------------------- 1 | # Domain Services 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/implementation/infrastructure.md: -------------------------------------------------------------------------------- 1 | # Infrastructure 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/implementation/infrastructure/message-brokers.md: -------------------------------------------------------------------------------- 1 | # Message Brokers 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/implementation/infrastructure/persistence.md: -------------------------------------------------------------------------------- 1 | # Persistence 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/implementation/language-model-integration.md: -------------------------------------------------------------------------------- 1 | # Language Model Integration 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/implementation/project-structure.md: -------------------------------------------------------------------------------- 1 | # Project Structure 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/introduction/overview.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/testing/ci-cd.md: -------------------------------------------------------------------------------- 1 | # Continuous Integration and Delivery 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/testing/integration-testing.md: -------------------------------------------------------------------------------- 1 | # Integration Testing 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/testing/monitoring.md: -------------------------------------------------------------------------------- 1 | # Monitoring and Observability 2 | -------------------------------------------------------------------------------- /src/dspygen/books/socratic_tutor/src/testing/unit-testing.md: -------------------------------------------------------------------------------- 1 | # Unit Testing 2 | -------------------------------------------------------------------------------- /src/dspygen/bpel_diagrams/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/bpel_diagrams/__init__.py -------------------------------------------------------------------------------- /src/dspygen/bpel_models/__init__.py: -------------------------------------------------------------------------------- 1 | # Empty file indicating bpel_models is a package 2 | -------------------------------------------------------------------------------- /src/dspygen/bpmn_models/__init__.py: -------------------------------------------------------------------------------- 1 | # Empty file indicating bpmn_models is a package 2 | -------------------------------------------------------------------------------- /src/dspygen/bpmn_models/flow_objects.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module defines Pydantic models for different types of flow objects commonly used in BPMN (Business Process Model and Notation) diagrams. 3 | Flow objects represent work that is performed within a process and include tasks and subprocesses. 4 | 5 | The flow object models defined in this module include: 6 | - Task: Represents a task in BPMN, which is a unit of work that is performed within a process. 7 | - SubProcess: Represents a subprocess in BPMN, which is a sequence of activities that is defined within a larger process. 8 | """ 9 | 10 | from pydantic import BaseModel, Field 11 | from typing import Optional 12 | 13 | 14 | class Task(BaseModel): 15 | """ 16 | Represents a task in BPMN, which is a unit of work that is performed within a process. 17 | """ 18 | id: str = Field(..., description="Unique identifier for the task.") 19 | name: Optional[str] = Field(None, description="Name of the task, if any.") 20 | 21 | 22 | class SubProcess(BaseModel): 23 | """ 24 | Represents a subprocess in BPMN, which is a sequence of activities that is defined within a larger process. 25 | """ 26 | id: str = Field(..., description="Unique identifier for the subprocess.") 27 | name: Optional[str] = Field(None, description="Name of the subprocess, if any.") 28 | -------------------------------------------------------------------------------- /src/dspygen/bpmn_models/gateways.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module defines Pydantic models for different types of gateways commonly used in BPMN (Business Process Model and Notation) diagrams. 3 | Gateways represent decision points or branching points within a process flow, where the flow of control can diverge or converge. 4 | 5 | The gateway models defined in this module include: 6 | - Gateway: Represents a generic gateway in BPMN. 7 | """ 8 | 9 | from pydantic import BaseModel, Field 10 | from typing import Optional 11 | 12 | class Gateway(BaseModel): 13 | """ 14 | Represents a generic gateway in BPMN. 15 | """ 16 | id: str = Field(..., description="Unique identifier for the gateway.") 17 | name: Optional[str] = Field(None, description="Name of the gateway, if any.") 18 | gateway_type: str = Field(..., description="Type of the gateway, such as 'exclusive', 'inclusive', 'parallel', etc.") 19 | -------------------------------------------------------------------------------- /src/dspygen/bpmn_models/sub_processes.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module defines Pydantic models for subprocesses commonly used in BPMN (Business Process Model and Notation) diagrams. 3 | Subprocesses represent a sequence of activities that is defined within a larger process. 4 | 5 | The models defined in this module include: 6 | - SubProcess: Represents a subprocess in BPMN. 7 | """ 8 | 9 | from pydantic import BaseModel, Field 10 | from typing import Optional, List 11 | 12 | 13 | class SubProcess(BaseModel): 14 | """ 15 | Represents a subprocess in BPMN, which is a sequence of activities that is defined within a larger process. 16 | """ 17 | id: str = Field(..., description="Unique identifier for the subprocess.") 18 | name: Optional[str] = Field(None, description="Name of the subprocess, if any.") 19 | flow_objects: List[str] = Field(..., description="List of flow objects contained within the subprocess.") 20 | -------------------------------------------------------------------------------- /src/dspygen/chatgpt_integration.py: -------------------------------------------------------------------------------- 1 | import openai 2 | import os 3 | from dotenv import load_dotenv 4 | 5 | # Load environments variables from .env file 6 | load_dotenv() 7 | 8 | # Initialize OpenAI client 9 | openai.api_key = os.getenv('OPENAI_API_KEY') 10 | 11 | def send_message_to_chatgpt(message): 12 | """ 13 | Sends a message to OpenAI's GPT-3.5-turbo model and returns the response. 14 | """ 15 | completion = openai.ChatCompletion.create( 16 | model="gpt-3.5-turbo-0125", 17 | messages=[ 18 | {"role": "system", "content": "You are a helpful AI assistant"}, 19 | {"role": "user", "content": message} 20 | ] 21 | ) 22 | 23 | response_message = completion['choices'][0]['message']['content'] 24 | return response_message.strip() 25 | -------------------------------------------------------------------------------- /src/dspygen/config.yaml: -------------------------------------------------------------------------------- 1 | default_context: 2 | project_type: "app" 3 | project_name: "TODO" 4 | project_description: "TODO" 5 | project_url: "https://github.com/to/do" 6 | author_name: "TODO" 7 | author_email: "to@do.com" 8 | python_version: "3.10" 9 | docker_image: "python:3.10-slim" 10 | development_environment: "simple" 11 | with_conventional_commits: "0" 12 | with_fastapi_api: "1" 13 | with_typer_cli: "1" 14 | continuous_integration: "GitHub" 15 | private_package_repository_name: "" 16 | private_package_repository_url: "" 17 | -------------------------------------------------------------------------------- /src/dspygen/di_configure.py: -------------------------------------------------------------------------------- 1 | import inject 2 | import gspread 3 | from google.oauth2.service_account import Credentials 4 | from pathlib import Path 5 | 6 | from dspygen.utils.file_tools import project_dir 7 | 8 | 9 | def configure(binder): 10 | """Configure dependency injection bindings.""" 11 | 12 | credentials_json = project_dir() / "credentials.json" 13 | 14 | if not Path(credentials_json).exists(): 15 | return 16 | 17 | scopes = ["https://www.googleapis.com/auth/spreadsheets"] 18 | creds = Credentials.from_service_account_file(credentials_json, scopes=scopes) 19 | client = gspread.authorize(creds) 20 | 21 | binder.bind(Credentials, creds) 22 | binder.bind(gspread.Client, client) 23 | -------------------------------------------------------------------------------- /src/dspygen/experiments/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/agile_protocol/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/agile_protocol/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/aider_bp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/aider_bp/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/auto_spider/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/auto_spider/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/auto_spider/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/auto_spider/example.png -------------------------------------------------------------------------------- /src/dspygen/experiments/bkgn/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/bkgn/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/bkgn/chapter_draft.py: -------------------------------------------------------------------------------- 1 | from dspygen.rm.code_retriever import CodeRetriever 2 | 3 | 4 | def main(): 5 | path = "/Users/sac/dev/dspygen/src/dspygen/books/socratic_tutor/src" 6 | gitignore = "/Users/sac/dev/dspygen/.gitignore" # Optional 7 | 8 | code_retriever = CodeRetriever(path, gitignore) 9 | result = code_retriever.forward("*md") 10 | for file_content in result.passages: 11 | print(file_content) # Here, you can instead write to a Markdown file or process further. 12 | 13 | # If I want one file containing all the code snippets 14 | # with open("code_snippets.md", "w") as f: 15 | # for file_content in result.passages: 16 | # f.write(file_content) 17 | 18 | 19 | if __name__ == '__main__': 20 | main() 21 | -------------------------------------------------------------------------------- /src/dspygen/experiments/bulk_code_generator/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/bulk_code_generator/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/bulk_code_generator/main.py: -------------------------------------------------------------------------------- 1 | from loguru import logger 2 | 3 | from dspygen.modules.python_source_code_module import python_source_code_call 4 | from dspygen.rm.chatgpt_chromadb_retriever import ChatGPTChromaDBRetriever 5 | from dspygen.utils.dspy_tools import init_dspy, init_ol 6 | from dspygen.lm.groq_lm import Groq 7 | 8 | 9 | def main(): 10 | #init_dspy(lm_class=Groq, model="mixtral-8x7b-32768") 11 | init_ol("phi3:medium", max_tokens=1000) 12 | retriever = ChatGPTChromaDBRetriever() 13 | query = "Revenue Operations Automation" 14 | matched_conversations = retriever.forward(query, k=10) 15 | # print(count_tokens(str(matched_conversations) + "\nI want a DSPy module that generates Python source code.")) 16 | for conversation in matched_conversations: 17 | logger.info(conversation) 18 | 19 | logger.info(python_source_code_call(str(matched_conversations))) 20 | 21 | 22 | if __name__ == '__main__': 23 | main() 24 | -------------------------------------------------------------------------------- /src/dspygen/experiments/business_patterns_for_devs.py: -------------------------------------------------------------------------------- 1 | import dspy 2 | 3 | from dspygen.rm.doc_retriever import DocRetriever 4 | from dspygen.utils.dspy_tools import init_dspy 5 | 6 | 7 | def main(): 8 | drt = DocRetriever(path="/Users/sac/Downloads/BusPatterns.pdf") 9 | business_text = drt.forward() 10 | print(business_text) 11 | 12 | init_dspy() 13 | 14 | business_text += "\nCreate a table of contents for the business patterns document, no software patterns." 15 | 16 | pred = dspy.Predict("business_text -> yaml_table_of_contents") 17 | result = pred.forward(business_text=business_text).yaml_table_of_contents 18 | # print(result) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /src/dspygen/experiments/cliapi/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/cliapi/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/cmdgen/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/cmdgen/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/domain_xml/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/domain_xml/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/domains/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/domains/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/done/WebsitePRD_pipeline.yaml: -------------------------------------------------------------------------------- 1 | config: 2 | current_step: null 3 | global_signatures: {} 4 | context: {} 5 | lm_models: [] 6 | modules: 7 | - name: WebsitePRD 8 | predictor: Predict 9 | signature: WebsitePRD 10 | rm_models: [] 11 | signatures: 12 | - docstring: This Signature generates a product requirements document for a website. 13 | inputs: 14 | - desc: Requirements for the design of the website. 15 | name: DesignRequirements 16 | prefix: Design 17 | name: WebsitePRD 18 | outputs: 19 | - desc: The final product requirements document for the website. 20 | name: ProductRequirementsDocument 21 | prefix: Product 22 | steps: 23 | - args: 24 | DesignRequirements: '{{ user_input }}' 25 | lm_model: default 26 | module: WebsitePRD 27 | rm_model: '' 28 | signature: WebsitePRD 29 | -------------------------------------------------------------------------------- /src/dspygen/experiments/done/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/done/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/done/chatbots.py: -------------------------------------------------------------------------------- 1 | from dspygen.modules.gen_keyword_arguments_module import invoke 2 | from dspygen.utils.dspy_tools import init_dspy, init_ol 3 | 4 | def chat(message: str): 5 | # Function to handle the chat logic 6 | print(f"Received message: {message}") 7 | return f"Response to: {message}" 8 | 9 | def invoke_response(message: str): 10 | # Provide the prompt as a formatted string 11 | prompt = f"{message}\nbot:" 12 | print(f"Generated prompt: {prompt}") # Debug statement to check prompt 13 | try: 14 | response = invoke(chat, prompt=prompt) 15 | except ValueError as e: 16 | print(f"Error while invoking: {e}") # Catch and print the error 17 | raise 18 | return response 19 | 20 | def main(): 21 | response = invoke_response("bot: Hello world") 22 | print(response) 23 | 24 | if __name__ == '__main__': 25 | init_ol() 26 | main() 27 | -------------------------------------------------------------------------------- /src/dspygen/experiments/done/code_generator_agent.py: -------------------------------------------------------------------------------- 1 | from dspygen.modules.gen_keyword_arguments_module import invoke 2 | from dspygen.modules.python_expert_module import python_expert_call 3 | from dspygen.utils.dspy_tools import init_ol 4 | 5 | 6 | def main(): 7 | init_ol() 8 | result = invoke(python_expert_call, "User Story: FastAPI CRUD routes for Fire Alarm IoT") 9 | print(result) 10 | 11 | 12 | if __name__ == '__main__': 13 | main() 14 | -------------------------------------------------------------------------------- /src/dspygen/experiments/done/file_path.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from dspygen.utils.file_tools import pages_dir 4 | 5 | 6 | def main(): 7 | print(pages_dir()) 8 | # print(pages_dir("hello.py")) 9 | 10 | print(os.path.exists(pages_dir())) 11 | # print(os.path.exists(pages_dir("hello.py")) 12 | 13 | 14 | if __name__ == '__main__': 15 | main() 16 | -------------------------------------------------------------------------------- /src/dspygen/experiments/done/first_step_with_user_input.py: -------------------------------------------------------------------------------- 1 | from dspygen.llm_pipe.dsl_pipeline_executor import execute_pipeline 2 | from dspygen.llm_pipe.dsl_pydantic_models import * 3 | 4 | 5 | def main(): 6 | from dspygen.utils.dspy_tools import init_dspy 7 | init_dspy() 8 | 9 | signature = GenSignatureModel.to_inst("Product Requirements Document for Websites") 10 | 11 | signature.inputs = [signature.inputs[0]] 12 | 13 | module = GenLMModuleModel.to_inst(f"{signature}") 14 | module.signature = signature.name 15 | 16 | arg_dict = {signature.inputs[0].name: "{{ user_input }}"} 17 | 18 | step = StepDSLModel(module=module.name, signature=signature.name, args=arg_dict) 19 | 20 | pipeline = PipelineDSLModel(signatures=[signature], modules=[module], steps=[step]) 21 | 22 | pipeline.to_yaml(f"{signature.name}_pipeline.yaml") 23 | 24 | context = execute_pipeline(f"{signature.name}_pipeline.yaml", 25 | {"user_input": "A full stack nextjs DSL pipeline nocode generator"}) 26 | 27 | print(context) 28 | 29 | 30 | if __name__ == '__main__': 31 | main() 32 | -------------------------------------------------------------------------------- /src/dspygen/experiments/done/openai_ror_cli.py: -------------------------------------------------------------------------------- 1 | 2 | import typer 3 | app = typer.Typer() 4 | 5 | @app.command(name="create") 6 | def create(): 7 | """Create a new OpenAI project with the given name""" 8 | # Command logic goes here 9 | print("This is the create command.") 10 | 11 | @app.command(name="train") 12 | def train(): 13 | """Train the OpenAI project with the given project ID""" 14 | # Command logic goes here 15 | print("This is the train command.") 16 | 17 | @app.command(name="generate") 18 | def generate(): 19 | """Generate text based on the given prompt""" 20 | # Command logic goes here 21 | print("This is the generate command.") 22 | 23 | @app.command(name="list") 24 | def list(): 25 | """List all OpenAI projects""" 26 | # Command logic goes here 27 | print("This is the list command.") 28 | 29 | @app.command(name="delete") 30 | def delete(): 31 | """Delete the OpenAI project with the given project ID""" 32 | # Command logic goes here 33 | print("This is the delete command.") 34 | 35 | @app.command(name="help") 36 | def help(): 37 | """Display help for a specific command""" 38 | # Command logic goes here 39 | print("This is the help command.") 40 | 41 | 42 | if __name__ == "__main__": 43 | app() 44 | 45 | -------------------------------------------------------------------------------- /src/dspygen/experiments/done/raw_to_structure_module.yaml: -------------------------------------------------------------------------------- 1 | args: [] 2 | name: RawToStructure 3 | predictor: Predict 4 | signature: raw_to_structure_signature 5 | -------------------------------------------------------------------------------- /src/dspygen/experiments/done/saltcorn_plugin_generator.py: -------------------------------------------------------------------------------- 1 | from dspygen.llm_pipe.dsl_pipeline_executor import execute_pipeline 2 | from dspygen.utils.file_tools import dsl_dir 3 | 4 | 5 | def main(): 6 | context = execute_pipeline(str(dsl_dir('examples/saltcorn_plugin_generator.yaml')), 7 | {"user_input": "Saltcorn Sequential Forms"}) 8 | 9 | print(context) 10 | 11 | context.to_yaml("saltcorn_plugin_generator_output.yaml") 12 | 13 | 14 | if __name__ == '__main__': 15 | main() 16 | -------------------------------------------------------------------------------- /src/dspygen/experiments/done/sql_to_natural_signature.yaml: -------------------------------------------------------------------------------- 1 | docstring: Generates a natural language description of an SQL query. 2 | inputs: 3 | - desc: The SQL query to be translated into natural language. 4 | name: query 5 | prefix: '' 6 | name: SQLQueryToNL 7 | outputs: 8 | - desc: The natural language description of the SQL query. 9 | name: description 10 | prefix: '' 11 | -------------------------------------------------------------------------------- /src/dspygen/experiments/function_calling/Chinook.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/function_calling/Chinook.db -------------------------------------------------------------------------------- /src/dspygen/experiments/function_calling/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/function_calling/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/function_calling/function_call.py: -------------------------------------------------------------------------------- 1 | def get_current_weather(location: str, temperature_unit: str) -> str: 2 | """ 3 | Get the current weather for a given location in the specified format. 4 | 5 | :param location: The city and state, e.g., "San Francisco, CA". 6 | :param temperature_unit: The temperature unit to use, either "celsius" or "fahrenheit". 7 | :return: A string describing the current weather. 8 | """ 9 | print(f"Retrieving weather for {location}, temperature unit: {temperature_unit}") 10 | # TODO: API Call 11 | return f"{location}, {temperature_unit}" 12 | 13 | 14 | def get_n_day_weather_forecast( 15 | location: str, temperature_unit: str, num_days: int 16 | ) -> str: 17 | """ 18 | Get an N-day weather forecast for a given location in the specified format. 19 | 20 | :param location: The city and state, e.g., "San Francisco, CA". 21 | :param temperature_unit: The temperature unit to use, either "celsius" or "fahrenheit". 22 | :param num_days: The number of days to forecast. 23 | :return: A string describing the weather forecast. 24 | """ 25 | print(f"Retrieving {num_days} day weather forecast for {location} in {temperature_unit}") 26 | return f"{location}, {temperature_unit}, {num_days}" 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/dspygen/experiments/function_calling/weather_function_calling_asserts.py: -------------------------------------------------------------------------------- 1 | from dspygen.experiments.function_calling.function_call import get_current_weather, get_n_day_weather_forecast 2 | from dspygen.modules.choose_function_module import choose_function_call 3 | from dspygen.modules.gen_keyword_arguments_module import gen_keyword_arguments_call 4 | from dspygen.utils.dspy_tools import init_dspy 5 | 6 | 7 | def chose_and_invoke(prompt, function_list): 8 | fn = choose_function_call(prompt=prompt, function_list=function_list) 9 | kwargs = gen_keyword_arguments_call(prompt, fn) 10 | return fn(**kwargs) 11 | 12 | def main(): 13 | init_dspy() 14 | 15 | function_list = [get_current_weather, get_n_day_weather_forecast] 16 | 17 | result = chose_and_invoke("Today's weather in los angeles", function_list) 18 | 19 | assert result == "Los Angeles, CA, fahrenheit" 20 | 21 | result = chose_and_invoke("Years weather in paris, france", function_list) 22 | 23 | assert result == 'Paris, France, celsius, 365' 24 | 25 | 26 | if __name__ == '__main__': 27 | main() 28 | -------------------------------------------------------------------------------- /src/dspygen/experiments/function_calling/weather_functions.exs: -------------------------------------------------------------------------------- 1 | def get_current_weather(location, temperature_unit) do """ Get the current weather for a given location in the specified format. :param location: The city and state, e.g., "San Francisco, CA". :param temperature_unit: The temperature unit to use, either "celsius" or "fahrenheit". :return: A string describing the current weather. """ IO.puts("Retrieving weather for #{location}, temperature unit: #{temperature_unit}") # TODO: API Call "#{location}, #{temperature_unit}" end def get_n_day_weather_forecast(location, temperature_unit, num_days) do """ Get an N-day weather forecast for a given location in the specified format. :param location: The city and state, e.g., "San Francisco, CA". :param temperature_unit: The temperature unit to use, either "celsius" or "fahrenheit". :param num_days: The number of days to forecast. :return: A string describing the weather forecast. """ IO.puts("Retrieving #{num_days} day weather forecast for #{location} in #{temperature_unit}") "#{location}, #{temperature_unit}, #{num_days}" end -------------------------------------------------------------------------------- /src/dspygen/experiments/gh_actions/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/gh_actions/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/gherkin_gen/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/gherkin_gen/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/gherkin_gen/docstring.j2: -------------------------------------------------------------------------------- 1 | ''' 2 | ```{{ content_type }} 3 | {{ content }} 4 | ``` 5 | ''' -------------------------------------------------------------------------------- /src/dspygen/experiments/gherkin_gen/gherkin_scenario.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel, Field, validator, root_validator, EmailStr, UrlStr 2 | from typing import List, Optional 3 | from datetime import datetime 4 | 5 | from sungen.utils.yaml_tools import YAMLMixin 6 | 7 | 8 | class GherkinScenario(BaseModel, YAMLMixin): 9 | """A Pydantic model representing a Gherkin Scenario.""" 10 | name: str = Field(default=None, title="", description="The name of the scenario.", min_length=1, max_length=255) 11 | description: str = Field(default=None, title="", description="A brief description of the scenario.", min_length=1, max_length=255) 12 | steps: list[str] = Field(default=[], title="", description="A list of steps in the scenario.") 13 | 14 | -------------------------------------------------------------------------------- /src/dspygen/experiments/go_high_level/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/go_high_level/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/go_high_level/ghl_scraper.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from bs4 import BeautifulSoup 3 | 4 | # URL of the documentation page 5 | url = "https://highlevel.stoplight.io/docs/integrations/0443d7d1a4bd0-overview" 6 | 7 | # Fetch the page content 8 | response = requests.get(url) 9 | soup = BeautifulSoup(response.text, 'html.parser') 10 | 11 | # Extract the relevant sections 12 | # Example: Extracting all headings and paragraphs 13 | headings = soup.find_all(['h1', 'h2', 'h3']) 14 | paragraphs = soup.find_all('p') 15 | 16 | # Print the extracted data 17 | for heading in headings: 18 | print(heading.get_text()) 19 | for para in paragraphs: 20 | print(para.get_text()) 21 | -------------------------------------------------------------------------------- /src/dspygen/experiments/linkedin_article/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/linkedin_article/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/mock_gen/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/mock_gen/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/mock_gen/optimized_signature.json: -------------------------------------------------------------------------------- 1 | { 2 | "predictor": { 3 | "lm": null, 4 | "traces": [], 5 | "train": [], 6 | "demos": [], 7 | "signature_instructions": "Proposed Instruction: Based on the provided `input` (data) and given a specific `instruction` detailing what analysis or transformation needs to be done, craft an output that succinctly captures the essence of this task. Use clear language and precise requirements in your instructions.", 8 | "signature_prefix": "To generate the result, analyze\/transform as instructed by considering the input provided.\n\nFor example, if you are given an `input` which is a collection of restaurant reviews and the `instruction` asks to extract key sentiments (positive or negative), the proposed prefix would be \"From analyzing the array of review texts provided, synthesize the dominant sentiment expressed in each." 9 | } 10 | } -------------------------------------------------------------------------------- /src/dspygen/experiments/model_pop/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/model_pop/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/module_docstrings/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/module_docstrings/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/module_docstrings/generate_docstring_exec.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import inflection 4 | from slugify import slugify 5 | 6 | from dspygen.llm_pipe.dsl_pipeline_executor import execute_pipeline 7 | 8 | 9 | def feature_code_generation(): 10 | 11 | context = execute_pipeline(f'{os.getcwd()}/data_gherkin_pipeline.yaml', 12 | init_ctx={"file_path": f"{os.getcwd()}/features.csv"}) 13 | 14 | file_name = "hello-world" # slugify(f"{inflection.underscore(result['FeatureDescription'])}") 15 | 16 | with open(f"{file_name}.tsx", 'w') as f: 17 | code = context.react_code 18 | # remove trailing ``` if present 19 | if code.endswith("```"): 20 | code = code[:-3] 21 | f.write(context.react_code) 22 | print(f"React JSX code written to {file_name}") 23 | 24 | 25 | def main(): 26 | feature_code_generation() 27 | 28 | 29 | if __name__ == '__main__': 30 | main() 31 | -------------------------------------------------------------------------------- /src/dspygen/experiments/nuxt_chatbot/components/ChatbotToggle.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | -------------------------------------------------------------------------------- /src/dspygen/experiments/nuxt_chatbot/pages/chat.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 22 | -------------------------------------------------------------------------------- /src/dspygen/experiments/nuxt_code_ret/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/nuxt_code_ret/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/obsidian_gen/2024-07-15_Power_and_Prediction_ML_and_Grid_Dynamics.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: note1 3 | title: '2024-07-15: Power and Prediction, ML, and Grid Dynamics' 4 | aliases: [] 5 | cssclass: note-class 6 | created_at: '2024-07-15T00:00:00+00:00' 7 | updated_at: '2024-07-15T00:00:00+00:00' 8 | publish: true 9 | permalink: http://example.com/note1 10 | description: A short description of the note. 11 | image: http://example.com/image.jpg 12 | cover: http://example.com/cover.jpg 13 | --- 14 | 15 | # 2024-07-15: Power and Prediction, ML, and Grid Dynamics 16 | 17 | This note focuses on various areas of research and development, including machine learning (ML) for predictive maintenance, process modeling with BPMN/CMMN/DMN, and grid dynamics in system control. Key tasks include preparing KPI goals for August, reviewing epics, stories, tasks, and subtasks for project management, and collaborating with industry leaders. Additionally, there’s emphasis on going through old resources, reviewing manuals (e.g., Cray supercomputer), and enhancing the Enterprise Kaizen model. 18 | 19 | #name='ML' #name='GridDynamics' #name='KPI' #name='Epics' #name='Kaizen' #name='PowerUseCase' #name='BPMN' #name='DMN' #name='OSIRIS' 20 | -------------------------------------------------------------------------------- /src/dspygen/experiments/obsidian_gen/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/obsidian_gen/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/paper2sys/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/paper2sys/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/paper2sys/create_from_paper.py: -------------------------------------------------------------------------------- 1 | def main(): 2 | """Main function""" 3 | from dspygen.utils.dspy_tools import init_ol 4 | init_ol() 5 | 6 | print("Hello World") 7 | 8 | 9 | 10 | 11 | if __name__ == '__main__': 12 | main() 13 | -------------------------------------------------------------------------------- /src/dspygen/experiments/phoenix/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/phoenix/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/pomo_bud/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/pomo_bud/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/pomo_bud/pomo_bud_dsl.yaml: -------------------------------------------------------------------------------- 1 | system_name: "OSIRIS-PomoBud" 2 | sensory_capabilities: 3 | - feature_name: "SpeechRecognition" 4 | sensory_type: "Auditory" 5 | inputs: ["audio"] 6 | outputs: ["text"] 7 | configurations: {} 8 | actuators: 9 | - feature_name: "TextToSpeech" 10 | actuator_type: "Speech" 11 | inputs: ["text"] 12 | outputs: ["audio"] 13 | configurations: {} 14 | cognitive_functions: 15 | - feature_name: "NaturalLanguageUnderstanding" 16 | cognitive_type: "NLP" 17 | inputs: ["text"] 18 | outputs: ["intent", "entities"] 19 | configurations: {} 20 | learning_mechanisms: 21 | - feature_name: "ReinforcementLearning" 22 | learning_type: "Adaptive" 23 | configurations: 24 | learning_rate: 0.01 25 | interaction_protocols: 26 | - feature_name: "ConversationalInterface" 27 | protocol_type: "ConversationalAI" 28 | inputs: ["text"] 29 | outputs: ["response"] 30 | configurations: {} 31 | continuous_adaptation: 32 | - mechanism_name: "SelfModification" 33 | details: 34 | update_frequency: "weekly" 35 | -------------------------------------------------------------------------------- /src/dspygen/experiments/powerpoint/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/powerpoint/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/quiz/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/quiz/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/quiz/session_data.json: -------------------------------------------------------------------------------- 1 | {"topics": [{"name": "Topic 1: Introduction to Philosophy", "content": "Philosophy is the study of fundamental questions about existence, knowledge, values, reason, and the mind."}, {"name": "Topic 2: Socratic Method", "content": "The Socratic method is a form of dialogue and questioning used to stimulate critical thinking and draw out ideas."}], "questions": [{"question": "What is philosophy?", "options": ["A. The study of fundamental questions about existence, knowledge, values, reason, and the mind", "B. A branch of science that deals with the natural world", "C. The practice of making persuasive arguments", "D. The art of creating beautiful works"], "answer": "A"}, {"question": "What is the goal of the Socratic method?", "options": ["A. To memorize facts and information", "B. To engage in small talk and casual conversation", "C. To deepen understanding, encourage self-reflection, and facilitate the discovery of truth", "D. To prove one's superiority over others"], "answer": "C"}], "current_topic_index": 1, "score": 4} -------------------------------------------------------------------------------- /src/dspygen/experiments/raga/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/raga/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/react_code_gen/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/confirm-signature-placement.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | 3 | interface SignaturePlacementProps { 4 | document: Document; 5 | } 6 | 7 | const SignaturePlacement: React.FC = ({ document }) => { 8 | const [signature, setSignature] = useState(null); 9 | 10 | const handleSignatureFieldClick = (event: React.MouseEvent) => { 11 | const signatureField = event.currentTarget; 12 | const signature = document.getSignature(signatureField.id); 13 | setSignature(signature); 14 | }; 15 | 16 | return ( 17 |
18 | 19 | 20 | {signature && } 21 |
22 | ); 23 | }; 24 | 25 | export default SignaturePlacement; 26 | ``` -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/custom-signing-instructions.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | 3 | const CustomSigningInstructions = () => { 4 | const [customInstructions, setCustomInstructions] = useState(''); 5 | 6 | const handleCustomInstructionsChange = (e: React.ChangeEvent) => { 7 | setCustomInstructions(e.target.value); 8 | }; 9 | 10 | const handleSaveCustomInstructions = () => { 11 | // save custom instructions 12 | }; 13 | 14 | return ( 15 |
16 | 17 | 18 |

{customInstructions}

19 |
20 | ); 21 | }; 22 | ``` -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/document-download.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | 3 | const DocumentDownload = () => { 4 | const [downloaded, setDownloaded] = useState(false); 5 | 6 | useEffect(() => { 7 | if (downloaded) { 8 | // download document 9 | } 10 | }, [downloaded]); 11 | 12 | return ( 13 |
14 | 15 |
16 | ); 17 | }; 18 | ``` -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/document-upload.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | 3 | interface DocumentUploadProps { 4 | onUpload: (file: File) => void; 5 | onCancel: () => void; 6 | } 7 | 8 | const DocumentUpload: React.FC = ({ onUpload, onCancel }) => { 9 | const [files, setFiles] = useState([]); 10 | const [error, setError] = useState(''); 11 | 12 | const handleFileChange = (e: React.ChangeEvent) => { 13 | const fileList = e.target.files; 14 | if (fileList) { 15 | const filesArray = Array.from(fileList); 16 | setFiles(filesArray); 17 | } 18 | }; 19 | 20 | const handleUpload = () => { 21 | files.forEach((file) => { 22 | if (file.type !== 'application/pdf') { 23 | setError('Invalid file format'); 24 | } else if (file.size > 1000000) { 25 | setError('File size too large'); 26 | } else { 27 | onUpload(file); 28 | } 29 | }); 30 | }; 31 | 32 | return ( 33 |
34 | 35 | 36 | 37 | {error &&

{error}

} 38 |
39 | ); 40 | }; 41 | 42 | export default DocumentUpload; 43 | ``` -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/drag-and-drop-document-upload.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | 3 | const DragAndDropDocumentUpload = () => { 4 | const [document, setDocument] = useState(null); 5 | 6 | const handleDrop = (e) => { 7 | e.preventDefault(); 8 | const file = e.dataTransfer.files[0]; 9 | setDocument(file); 10 | }; 11 | 12 | const handleDragOver = (e) => { 13 | e.preventDefault(); 14 | }; 15 | 16 | return ( 17 |
21 | {document &&

{document.name}

} 22 |
23 | ); 24 | }; 25 | 26 | export default DragAndDropDocumentUpload; 27 | ``` -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/email-confirmation-to-sender.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | 3 | interface EmailConfirmationProps { 4 | sender: string; 5 | email: string; 6 | } 7 | 8 | const EmailConfirmation: React.FC = ({ sender, email }) => { 9 | const [confirmation, setConfirmation] = useState(false); 10 | 11 | useEffect(() => { 12 | if (email) { 13 | setConfirmation(true); 14 | } 15 | }, [email]); 16 | 17 | return ( 18 |
19 | {confirmation ? ( 20 |

{`Email successfully delivered to ${sender}.`}

21 | ) : ( 22 |

{`Email failed to deliver to ${sender}.`}

23 | )} 24 |
25 | ); 26 | }; 27 | 28 | export default EmailConfirmation; 29 | ``` -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/feature_data_pipeline.yaml: -------------------------------------------------------------------------------- 1 | # feature_data_pipeline.yaml 2 | rm_models: 3 | - label: "data_retriever" 4 | name: "DataRetriever" 5 | 6 | steps: 7 | - module: "FeatureDataModule" 8 | rm_model: "data_retriever" 9 | -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/generate-unique-signing-link.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | 3 | interface Props { 4 | name: string; 5 | email: string; 6 | } 7 | 8 | const SigningLinkGenerator: React.FC = ({ name, email }) => { 9 | const [link, setLink] = useState(''); 10 | const [error, setError] = useState(''); 11 | 12 | const generateLink = () => { 13 | if (!name || !email) { 14 | setError('Please enter a valid name and email'); 15 | return; 16 | } 17 | 18 | const link = `https://signinglink.com/${name}/${email}`; 19 | setLink(link); 20 | }; 21 | 22 | useEffect(() => { 23 | const timer = setTimeout(() => { 24 | setLink(''); 25 | }, 86400000); 26 | 27 | return () => clearTimeout(timer); 28 | }, []); 29 | 30 | return ( 31 |
32 | setName(e.target.value)} /> 33 | setEmail(e.target.value)} /> 34 | 35 | {error &&

{error}

} 36 | {link && Click here to sign} 37 |
38 | ); 39 | }; 40 | 41 | export default SigningLinkGenerator; 42 | ``` -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/generate_react_code_from_csv.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import inflection 4 | from slugify import slugify 5 | 6 | from dspygen.llm_pipe.dsl_pipeline_executor import execute_pipeline 7 | 8 | 9 | def feature_code_generation(): 10 | context = execute_pipeline(f'{os.getcwd()}/feature_data_pipeline.yaml', 11 | init_ctx={"file_path": f"{os.getcwd()}/features.csv"}) 12 | 13 | for result in context.data: 14 | print(result) 15 | context = execute_pipeline(f'{os.getcwd()}/gherkin_pipeline.yaml', init_ctx=context) 16 | 17 | file_name = slugify(f"{inflection.underscore(result['FeatureDescription'])}") 18 | 19 | with open(f"{file_name}.tsx", 'w') as f: 20 | code = context.react_code 21 | # remove trailing ``` if present 22 | if code.endswith("```"): 23 | code = code[:-3] 24 | f.write(context.react_code) 25 | print(f"React JSX code written to {file_name}") 26 | 27 | 28 | def main(): 29 | feature_code_generation() 30 | 31 | 32 | if __name__ == '__main__': 33 | main() 34 | -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/link-expiration.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | 3 | interface Props { 4 | link: string; 5 | expirationDate: Date; 6 | } 7 | 8 | const LinkExpiration: React.FC = ({ link, expirationDate }) => { 9 | const [isExpired, setIsExpired] = useState(false); 10 | 11 | useEffect(() => { 12 | const currentDate = new Date(); 13 | if (currentDate > expirationDate) { 14 | setIsExpired(true); 15 | } 16 | }, [expirationDate]); 17 | 18 | return ( 19 |
20 | {isExpired ? ( 21 |

The link is no longer accessible.

22 | ) : ( 23 | Link 24 | )} 25 |
26 | ); 27 | }; 28 | 29 | export default LinkExpiration; 30 | ``` -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/retrieve_and_generate_pipeline.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import inflection 4 | from slugify import slugify 5 | 6 | from dspygen.llm_pipe.dsl_pipeline_executor import execute_pipeline 7 | 8 | 9 | def feature_code_generation(): 10 | 11 | context = execute_pipeline(f'{os.getcwd()}/data_gherkin_pipeline.yaml', 12 | init_ctx={"file_path": f"{os.getcwd()}/features.csv"}) 13 | 14 | file_name = "hello-world" # slugify(f"{inflection.underscore(result['FeatureDescription'])}") 15 | 16 | with open(f"{file_name}.tsx", 'w') as f: 17 | code = context.react_code 18 | # remove trailing ``` if present 19 | if code.endswith("```"): 20 | code = code[:-3] 21 | f.write(context.react_code) 22 | print(f"React JSX code written to {file_name}") 23 | 24 | 25 | def main(): 26 | feature_code_generation() 27 | 28 | 29 | if __name__ == '__main__': 30 | main() 31 | -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/save-signature.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | 3 | const SaveSignature = () => { 4 | const [signature, setSignature] = useState(''); 5 | 6 | const handleSave = () => { 7 | // save signature logic 8 | setSignature('saved'); 9 | }; 10 | 11 | return ( 12 |
13 |

Signature Page

14 | 15 |

{signature}

16 |
17 | ); 18 | }; 19 | 20 | export default SaveSignature; 21 | ``` -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/signature-capture.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | 3 | interface SignatureCaptureProps { 4 | onSave: (signature: string) => void; 5 | } 6 | 7 | const SignatureCapture: React.FC = ({ onSave }) => { 8 | const [signature, setSignature] = useState(''); 9 | 10 | const handleSave = () => { 11 | onSave(signature); 12 | }; 13 | 14 | return ( 15 |
16 |

Signature Capture

17 |
18 |

Instructions

19 |

Sign your name in the box below.

20 |
21 |
22 |

Signature

23 |
24 | setSignature(e.target.value)} 28 | /> 29 |
30 |
31 |
32 | 33 |
34 |
35 | ); 36 | }; 37 | 38 | export default SignatureCapture; 39 | ``` -------------------------------------------------------------------------------- /src/dspygen/experiments/react_code_gen/signature-validation.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | 3 | interface SignatureValidationProps { 4 | document: Document; 5 | } 6 | 7 | const SignatureValidation: React.FC = ({ document }) => { 8 | const [signature, setSignature] = useState(null); 9 | const [isValid, setIsValid] = useState(null); 10 | 11 | useEffect(() => { 12 | setSignature(document.signature); 13 | }, [document]); 14 | 15 | const validateSignature = () => { 16 | if (signature) { 17 | setIsValid(signature.isValid); 18 | } 19 | }; 20 | 21 | return ( 22 |
23 | 24 | {isValid !== null && ( 25 |

{isValid ? 'The signature is valid' : 'The signature is invalid'}

26 | )} 27 |
28 | ); 29 | }; 30 | 31 | export default SignatureValidation; 32 | ``` -------------------------------------------------------------------------------- /src/dspygen/experiments/rfc5545/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/rfc5545/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/rfc5545/ical_data_ret.py: -------------------------------------------------------------------------------- 1 | from dspygen.rm.data_retriever import DataRetriever 2 | from dspygen.utils.file_tools import data_dir 3 | 4 | 5 | def main(): 6 | """Main function""" 7 | 8 | ret = DataRetriever(data_dir('dev.csv'), "SELECT * FROM event").forward() 9 | print(ret) 10 | 11 | 12 | if __name__ == '__main__': 13 | main() 14 | -------------------------------------------------------------------------------- /src/dspygen/experiments/rfc5545/ical_db_session.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from sqlalchemy import create_engine 4 | from sqlmodel import Session, SQLModel 5 | 6 | from dspygen.utils.file_tools import data_dir 7 | 8 | 9 | # from utils.chroma_memstore import ChromaMemStore 10 | 11 | 12 | # def get_mem_store(): 13 | # return ChromaMemStore(mem_store_path) 14 | 15 | 16 | def get_session(): 17 | DATABASE_URL = f"sqlite:///{data_dir('dev.db')}" 18 | 19 | engine = create_engine(DATABASE_URL) 20 | 21 | SQLModel.metadata.create_all(engine) 22 | 23 | return Session(engine) 24 | -------------------------------------------------------------------------------- /src/dspygen/experiments/rfc5545/ical_workbench.py: -------------------------------------------------------------------------------- 1 | from dspygen.experiments.rfc5545.ical_db_session import get_session 2 | from dspygen.experiments.rfc5545.ical_models import Event 3 | 4 | 5 | def create_event(): 6 | Event.create(dtstart="2021-01-01T00:00:00", dtend="2021-01-01T01:00:00", summary="Test event") 7 | 8 | 9 | def get_events(): 10 | events = Event.get_by_page(page=0, per_page=10, include_past=True) 11 | for event in events: 12 | print(event) 13 | return events 14 | 15 | 16 | def update_event(): 17 | event = Event.update(event_id=1, summary="Updated event") 18 | 19 | 20 | def main(): 21 | """Main function""" 22 | get_session() 23 | # create_event() 24 | # get_events() 25 | update_event() 26 | get_events() 27 | 28 | if __name__ == '__main__': 29 | main() 30 | -------------------------------------------------------------------------------- /src/dspygen/experiments/self_coding/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/self_coding/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/self_coding/hello.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @module HelloWorld 3 | * @description A simple Hello World program demonstrating TypeScript best practices 4 | */ 5 | 6 | /** 7 | * Generates a greeting message 8 | * @param name - The name to greet (optional) 9 | * @returns A greeting string 10 | */ 11 | function generateGreeting(name: string = 'World'): string { 12 | return `Hello, ${name}!`; 13 | } 14 | 15 | /** 16 | * Main function to execute the program 17 | */ 18 | function main(): void { 19 | const greeting = generateGreeting(); 20 | console.log(greeting); 21 | } 22 | 23 | // Execute the program 24 | main(); -------------------------------------------------------------------------------- /src/dspygen/experiments/soonify_groq/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/soonify_groq/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/spider/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/spider/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/.gitignore -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/LICENSE -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/README.md -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/assets/images/.keep -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/assets/sounds/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/assets/sounds/.keep -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/config/dev.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/config/dev.json -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/config/prod.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/config/prod.json -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/config/test.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/config/test.json -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/docs/CurriculumAlignment.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/docs/CurriculumAlignment.md -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/docs/GettingStarted.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/docs/GettingStarted.md -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/docs/TechnicalOverview.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/docs/TechnicalOverview.md -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/lib/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/lib/.keep -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/scripts/deploy.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/scripts/deploy.sh -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/scripts/maintenance.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/scripts/maintenance.sh -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/scripts/setup.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/scripts/setup.sh -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/src/core/education_module.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/src/core/education_module.py -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/src/core/game_engine.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/src/core/game_engine.py -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/src/core/narrative_engine.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/src/core/narrative_engine.py -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/src/ui/modules/chatbot_view.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/src/ui/modules/chatbot_view.py -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/src/ui/modules/quiz_view.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/src/ui/modules/quiz_view.py -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/src/ui/modules/story_view.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/src/ui/modules/story_view.py -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/src/ui/utils/formatting_tools.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/src/ui/utils/formatting_tools.py -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/src/ui/utils/ui_helpers.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/src/ui/utils/ui_helpers.py -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/tests/integration/chatbot_integration_test.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/tests/integration/chatbot_integration_test.py -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/tests/integration/quiz_integration_test.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/tests/integration/quiz_integration_test.py -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/tests/integration/story_integration_test.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/tests/integration/story_integration_test.py -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/tests/unit/education_module_test.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/tests/unit/education_module_test.py -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/tests/unit/game_engine_test.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/tests/unit/game_engine_test.py -------------------------------------------------------------------------------- /src/dspygen/experiments/tagee/tests/unit/narrative_engine_test.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/tagee/tests/unit/narrative_engine_test.py -------------------------------------------------------------------------------- /src/dspygen/experiments/text_to_json/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/text_to_json/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/text_to_json/cot_2024-05-16_04-48-51.json: -------------------------------------------------------------------------------- 1 | { 2 | "predictor": { 3 | "lm": null, 4 | "traces": [], 5 | "train": [], 6 | "demos": [], 7 | "signature_instructions": "Given the fields `json_schema`, `prompt`, produce the fields `output`.", 8 | "signature_prefix": "Output:" 9 | }, 10 | "retry_predictor": { 11 | "lm": null, 12 | "traces": [], 13 | "train": [], 14 | "demos": [], 15 | "signature_instructions": "\n <|user|>\n Review a given JSON object using its defined schema to identify discrepancies between the structure of the provided data and expected rules, then suggest amendments. Start by evaluating the entire JSON against its schema comprehensively, listing out areas where it fails to meet specifications. Devise precise instructions for each identified inconsistency that will iteratively refine the accuracy of the JSON object to perfectly match the schema until no validation issues remain. ", 16 | "signature_prefix": "\n<|end|>\n<|assistant|>\nThe Post-Correction Constructed JSON Object:\n```json\n" 17 | } 18 | } -------------------------------------------------------------------------------- /src/dspygen/experiments/txta/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/txta/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/typed_gherkin/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/typed_gherkin/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/wip/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/wip/__init__.py -------------------------------------------------------------------------------- /src/dspygen/experiments/wip/default_pipeline.yaml: -------------------------------------------------------------------------------- 1 | config: 2 | current_step: 3 | args: {} 4 | lm_model: default 5 | module: dspygen.dsl.dsl_dspy_module.DSLModule 6 | rm_model: default 7 | signature: default 8 | global_signatures: {} 9 | context: {} 10 | lm_models: 11 | - args: {} 12 | label: default 13 | name: OpenAI 14 | lm_modules: 15 | - name: default 16 | predictor: Predict 17 | signature: default 18 | rm_models: 19 | - args: {} 20 | label: default 21 | name: default 22 | rm_modules: 23 | - name: default 24 | signatures: 25 | - docstring: default 26 | inputs: 27 | - desc: default 28 | name: default 29 | prefix: '' 30 | name: default 31 | outputs: 32 | - desc: default 33 | name: default 34 | prefix: '' 35 | steps: 36 | - args: {} 37 | lm_model: default 38 | module: dspygen.dsl.dsl_dspy_module.DSLModule 39 | rm_model: default 40 | signature: default 41 | -------------------------------------------------------------------------------- /src/dspygen/experiments/wip/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/experiments/wip/models/__init__.py -------------------------------------------------------------------------------- /src/dspygen/llm_pipe/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/llm_pipe/__init__.py -------------------------------------------------------------------------------- /src/dspygen/llm_pipe/examples/blog_pipeline.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - module: "dspygen.modules.blog_module.BlogModule" 3 | args: 4 | subject: "{{ subject }}" 5 | -------------------------------------------------------------------------------- /src/dspygen/llm_pipe/examples/example_pipeline.yaml: -------------------------------------------------------------------------------- 1 | lm_models: 2 | - label: "default" 3 | name: "OpenAI" 4 | 5 | signatures: 6 | - name: "GenerateGherkinSignature" 7 | docstring: "Generates a comprehensive gherkin from structured data." 8 | inputs: 9 | - name: "processed_data" 10 | desc: "Structured data to be included in the gherkin." 11 | outputs: 12 | - name: "gherkin" 13 | desc: "The final gherkin generated from the structured data." 14 | 15 | lm_modules: 16 | - name: "GherkinGeneratorModule" 17 | signature: "GenerateGherkinSignature" 18 | predictor: "ChainOfThought" 19 | args: 20 | - name: "gherkin_scenarios" 21 | value: "StandardGherkinTemplate" 22 | 23 | steps: 24 | - file: "feature_list.yaml" 25 | 26 | - module: "GherkinGeneratorModule" 27 | lm_model: "fast" 28 | args: 29 | processed_data: "{{ processed_data }}" -------------------------------------------------------------------------------- /src/dspygen/llm_pipe/examples/sql_to_nl.yaml: -------------------------------------------------------------------------------- 1 | lm_models: 2 | - label: "default" 3 | name: "OpenAI" 4 | args: 5 | max_tokens: 3000 6 | 7 | steps: 8 | - signature: "signature/sql_to_natural_signature.yaml" -------------------------------------------------------------------------------- /src/dspygen/llm_pipe/examples/text_signature_pipeline.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - signature: "raw_to_structure_signature.yaml" -------------------------------------------------------------------------------- /src/dspygen/llm_pipe/modules/raw_to_structure_module.yaml: -------------------------------------------------------------------------------- 1 | args: [] 2 | name: RawToStructure 3 | predictor: Predict 4 | signature: RawToStructuredSignature 5 | -------------------------------------------------------------------------------- /src/dspygen/llm_pipe/signature/sql_to_natural_signature.yaml: -------------------------------------------------------------------------------- 1 | name: SQLQueryToNL 2 | docstring: Generates a natural language description of an SQL query. 3 | inputs: 4 | - desc: The SQL query to be translated into natural language. 5 | name: query 6 | prefix: '' 7 | outputs: 8 | - desc: The natural language description of the SQL query. 9 | name: description 10 | prefix: '' 11 | - desc: The optimized SQL query. 12 | name: optimized_query 13 | prefix: '```sql' -------------------------------------------------------------------------------- /src/dspygen/llm_pipe/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/llm_pipe/utils/__init__.py -------------------------------------------------------------------------------- /src/dspygen/llm_pipe/utils/dsl_assertions_utils.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/llm_pipe/utils/dsl_assertions_utils.py -------------------------------------------------------------------------------- /src/dspygen/llm_pipe/utils/dsl_language_model_utils.py: -------------------------------------------------------------------------------- 1 | import dspy 2 | 3 | from dspygen.llm_pipe.dsl_pydantic_models import PipelineDSLModel 4 | 5 | 6 | def _get_language_model_instance(pipeline: PipelineDSLModel, step): 7 | """ 8 | Get the language model instance for a given step from the top level definition. 9 | """ 10 | lm_label = step.lm_model 11 | # Find the lm class within the dspy module. Need to import the class dynamically from the dspy module 12 | lm_config = next((m for m in pipeline.lm_models if m.label in lm_label), None) 13 | 14 | if lm_config is None: 15 | raise ValueError(f"Language model with label {lm_label} not found in the pipeline configuration.") 16 | 17 | lm_class = getattr(dspy, lm_config.name) 18 | lm_inst = lm_class(**lm_config.args) 19 | return lm_inst -------------------------------------------------------------------------------- /src/dspygen/llm_pipe/utils/dsl_retrieval_model_utils.py: -------------------------------------------------------------------------------- 1 | import dspy 2 | 3 | from dspygen.llm_pipe.dsl_pydantic_models import StepDSLModel, PipelineDSLModel 4 | from dspygen.rm.data_retriever import DataRetriever 5 | 6 | 7 | def _get_retrieval_model_instance(pipeline: PipelineDSLModel, step: StepDSLModel): 8 | """ 9 | Get the retrieval model instance for a given step from the top level definition. 10 | """ 11 | if not step.rm_model: 12 | return None 13 | 14 | rm_label = step.rm_model 15 | 16 | # Find the rm class within the dspy module. Need to import the class dynamically from the dspy module 17 | rm_config = next((m for m in pipeline.rm_models if m.label == rm_label), None) 18 | 19 | if rm_config.name == "DataRetriever": 20 | return DataRetriever(**rm_config.args) 21 | 22 | if rm_config and hasattr(dspy, rm_config.name): 23 | rm_class = getattr(dspy, rm_config.name) 24 | rm_inst = rm_class(**rm_config.args) 25 | return rm_inst 26 | -------------------------------------------------------------------------------- /src/dspygen/llm_pipe/utils/dsl_rm_module_utils.py: -------------------------------------------------------------------------------- 1 | import importlib 2 | 3 | import dspy 4 | 5 | from dspygen.llm_pipe.dsl_pydantic_models import RMModuleDSLModel 6 | from dspygen.rm.data_retriever import DataRetriever 7 | 8 | 9 | def _create_rm_module_from_model(module_model: RMModuleDSLModel) -> dspy.Module: 10 | """ 11 | Create a DSPy Module from a ModuleDSLModel instance. 12 | """ 13 | 14 | 15 | def _load_rm_module_class(dspy_module_class_name: str): 16 | """ 17 | Dynamically loads a signature class by its fully qualified name. 18 | """ 19 | module_name, class_name = dspy_module_class_name.rsplit('.', 1) 20 | module = importlib.import_module(module_name) 21 | return getattr(module, class_name) 22 | 23 | 24 | def _get_rm_module_instance(pipeline, rendered_args, step): 25 | """ 26 | Get the module instance for a given step from the top level definition or load the module. 27 | Uses the DSLModule class from dspygen.dspy_modules.dsl_module to handle dspy_modules defined in the pipeline YAML. 28 | """ 29 | # Get the file_path from the pipeline.context or rendered_args 30 | # file_path = pipeline.context.get("file_path", rendered_args.get("file_path")) 31 | 32 | return DataRetriever(pipeline=pipeline, step=step, **rendered_args) 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/dspygen/lm/__init__.py: -------------------------------------------------------------------------------- 1 | """dspygen package.""" 2 | -------------------------------------------------------------------------------- /src/dspygen/mixin/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/mixin/__init__.py -------------------------------------------------------------------------------- /src/dspygen/mixin/btrees/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/mixin/btrees/__init__.py -------------------------------------------------------------------------------- /src/dspygen/mixin/btrees/bt_traffic.py: -------------------------------------------------------------------------------- 1 | import py_trees 2 | import time 3 | 4 | class TrafficLightSequence(py_trees.behaviour.Behaviour): 5 | def __init__(self, name): 6 | super(TrafficLightSequence, self).__init__(name) 7 | self.red_duration = 5 8 | self.yellow_duration = 2 9 | self.green_duration = 5 10 | 11 | def update(self): 12 | print("Red light") 13 | time.sleep(self.red_duration) 14 | print("Yellow light") 15 | time.sleep(self.yellow_duration) 16 | print("Green light") 17 | time.sleep(self.green_duration) 18 | return py_trees.common.Status.SUCCESS 19 | 20 | def create_tree(): 21 | root = py_trees.composites.Sequence("Traffic Light Sequence", memory=False) 22 | traffic_light = TrafficLightSequence("Traffic Light") 23 | root.add_child(traffic_light) 24 | return root 25 | 26 | def main(): 27 | py_trees.logging.level = py_trees.logging.Level.DEBUG 28 | tree = create_tree() 29 | print("Created tree") 30 | while True: 31 | tree.tick_once() 32 | 33 | if __name__ == "__main__": 34 | main() -------------------------------------------------------------------------------- /src/dspygen/mixin/fsm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/mixin/fsm/__init__.py -------------------------------------------------------------------------------- /src/dspygen/mixin/hsm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/mixin/hsm/__init__.py -------------------------------------------------------------------------------- /src/dspygen/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/models/__init__.py -------------------------------------------------------------------------------- /src/dspygen/models/dmn_shipping.yaml: -------------------------------------------------------------------------------- 1 | dmn: 2 | definitions: 3 | id: "shipment_decision_logic" 4 | name: "Shipment Decision Logic" 5 | decision: 6 | - id: "decision_1" 7 | name: "Determine Action Based on Shipment Status" 8 | decisionTable: 9 | inputs: 10 | - id: "input_1" 11 | label: "Shipment Status" 12 | inputExpression: "status" 13 | inputValues: ["Delivered", "In Transit", "Exception"] 14 | outputs: 15 | - id: "output_1" 16 | label: "Action" 17 | outputValues: ["Print Label", "Automate Browser", "Notify User"] 18 | rules: 19 | - inputEntries: 20 | - "Delivered" 21 | outputEntries: 22 | - "Print Label" 23 | - inputEntries: 24 | - "In Transit" 25 | outputEntries: 26 | - "Automate Browser" 27 | - inputEntries: 28 | - "Exception" 29 | outputEntries: 30 | - "Notify User" 31 | -------------------------------------------------------------------------------- /src/dspygen/module_docstring_writer.py: -------------------------------------------------------------------------------- 1 | def main(): 2 | print('main') 3 | 4 | 5 | if __name__ == '__main__': 6 | main() 7 | -------------------------------------------------------------------------------- /src/dspygen/modules/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/modules/__init__.py -------------------------------------------------------------------------------- /src/dspygen/modules/bill_of_objects_module.py: -------------------------------------------------------------------------------- 1 | import dspy 2 | from dspygen.utils.dspy_tools import init_dspy 3 | 4 | 5 | class BillOfObjectsModule(dspy.Module): 6 | """BillOfObjectsModule""" 7 | 8 | def __init__(self, **forward_args): 9 | super().__init__() 10 | self.forward_args = forward_args 11 | self.output = None 12 | 13 | def forward(self, source_text): 14 | pred = dspy.Predict("source_text -> bill_of_objects_csv") 15 | self.output = pred(source_text=source_text).bill_of_objects_csv 16 | return self.output 17 | 18 | 19 | def bill_of_objects_call(source_text): 20 | bill_of_objects = BillOfObjectsModule() 21 | return bill_of_objects.forward(source_text=source_text) 22 | 23 | 24 | def main(): 25 | init_dspy() 26 | source_text = "" 27 | print(bill_of_objects_call(source_text=source_text)) 28 | 29 | 30 | if __name__ == "__main__": 31 | main() 32 | -------------------------------------------------------------------------------- /src/dspygen/modules/business_dev_consultant.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | """ 4 | import dspy 5 | from typer import Typer 6 | from dspygen.utils.dspy_tools import init_dspy 7 | 8 | 9 | app = Typer() 10 | 11 | 12 | class BusinessDevConsultantModule(dspy.Module): 13 | """BusinessDevConsultantModule""" 14 | 15 | def forward(self, prompt): 16 | pred = dspy.ChainOfThought("prompt -> advice") 17 | result = pred(prompt=prompt).advice 18 | return result 19 | 20 | 21 | def business_dev_consultant_call(prompt): 22 | business_dev_consultant = BusinessDevConsultantModule() 23 | return business_dev_consultant.forward(prompt=prompt) 24 | 25 | 26 | @app.command() 27 | def call(prompt): 28 | """BusinessDevConsultantModule""" 29 | init_dspy() 30 | 31 | print(business_dev_consultant_call(prompt=prompt)) 32 | 33 | 34 | from fastapi import APIRouter 35 | router = APIRouter() 36 | 37 | @router.post("/business_dev_consultant/") 38 | async def business_dev_consultant_route(data: dict): 39 | # Your code generation logic here 40 | init_dspy() 41 | 42 | print(data) 43 | return business_dev_consultant_call(**data) 44 | 45 | 46 | def main(): 47 | init_dspy() 48 | prompt = "Merger of financial institution" 49 | print(business_dev_consultant_call(prompt=prompt)) 50 | 51 | 52 | if __name__ == "__main__": 53 | main() 54 | -------------------------------------------------------------------------------- /src/dspygen/modules/chat_bot_cli.py: -------------------------------------------------------------------------------- 1 | 2 | import typer 3 | app = typer.Typer() 4 | 5 | @app.command(name="chat") 6 | def chat(): 7 | """Start a chat session with the ChatBot.""" 8 | # Command logic goes here 9 | print("This is the chat command.") 10 | 11 | @app.command(name="clear") 12 | def clear(): 13 | """Clear the chat history.""" 14 | # Command logic goes here 15 | print("This is the clear command.") 16 | 17 | @app.command(name="history") 18 | def history(): 19 | """View the chat history.""" 20 | # Command logic goes here 21 | print("This is the history command.") 22 | 23 | @app.command(name="list") 24 | def list(): 25 | """List all available commands.""" 26 | # Command logic goes here 27 | print("This is the list command.") 28 | 29 | @app.command(name="settings") 30 | def settings(): 31 | """View or change ChatBot settings.""" 32 | # Command logic goes here 33 | print("This is the settings command.") 34 | 35 | @app.command(name="train") 36 | def train(): 37 | """Train the ChatBot with new data.""" 38 | # Command logic goes here 39 | print("This is the train command.") 40 | 41 | @app.command(name="version") 42 | def version(): 43 | """View the current ChatBot version.""" 44 | # Command logic goes here 45 | print("This is the version command.") 46 | 47 | 48 | if __name__ == "__main__": 49 | app() 50 | 51 | -------------------------------------------------------------------------------- /src/dspygen/modules/checker_module.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | """ 4 | import dspy 5 | from dspygen.utils.dspy_tools import init_dspy 6 | 7 | 8 | class CheckerModule(dspy.Module): 9 | """CheckerModule""" 10 | 11 | def forward(self, prompt, assertion): 12 | pred = dspy.ChainOfThought("prompt, assertion -> return_bool") 13 | result = pred(prompt=prompt, assertion=assertion).return_bool 14 | return result 15 | 16 | 17 | def checker_call(prompt, assertion): 18 | checker = CheckerModule() 19 | return checker.forward(prompt=prompt, assertion=assertion) 20 | 21 | 22 | def main(): 23 | init_dspy() 24 | prompt = "The earth is flat" 25 | assertion = "True" 26 | print(checker_call(prompt=prompt, assertion=assertion)) 27 | 28 | 29 | if __name__ == "__main__": 30 | main() 31 | -------------------------------------------------------------------------------- /src/dspygen/modules/cli_bot_module.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | """ 4 | import dspy 5 | from typer import Typer 6 | from dspygen.utils.dspy_tools import init_dspy 7 | 8 | 9 | app = Typer() 10 | 11 | 12 | class CLIBotModule(dspy.Module): 13 | """CLIBotModule""" 14 | 15 | def forward(self, prompt): 16 | pred = dspy.ChainOfThought("prompt -> bash_command_line_input") 17 | result = pred(prompt=prompt).bash_command_line_input 18 | return result 19 | 20 | 21 | def cli_bot_call(prompt): 22 | cli_bot = CLIBotModule() 23 | return cli_bot.forward(prompt=prompt) 24 | 25 | 26 | @app.command() 27 | def call(prompt): 28 | """CLIBotModule""" 29 | init_dspy() 30 | 31 | print(cli_bot_call(prompt=prompt)) 32 | 33 | 34 | from fastapi import APIRouter 35 | router = APIRouter() 36 | 37 | @router.post("/cli_bot/") 38 | async def cli_bot_route(data: dict): 39 | # Your code generation logic here 40 | init_dspy() 41 | 42 | print(data) 43 | return cli_bot_call(**data) 44 | 45 | 46 | def main(): 47 | init_dspy() 48 | prompt = "" 49 | print(cli_bot_call(prompt=prompt)) 50 | 51 | 52 | if __name__ == "__main__": 53 | main() 54 | -------------------------------------------------------------------------------- /src/dspygen/modules/dflss_output.txt: -------------------------------------------------------------------------------- 1 | 1. System: Order Processing System with DSPy Integration 2 | 2. Benefits: 3 | * Structured data handling 4 | * Automatic state management 5 | * Enhanced debugging capabilities through systematic logging and validation 6 | 3. Project Scope: 7 | * Convert existing order processing methods and transitions into DSPy-compatible modules 8 | * Utilize DSPy's capabilities for handling different states of an order's lifecycle within a declarative pipeline environment 9 | * Implement validation and action triggers as modular components 10 | * Integrate state change triggers with conditions and actions based on DSPy’s event-driven architecture 11 | 4. Implementation Plan and Guidelines: 12 | * Maintain all functionality within Python, ensuring no external system dependencies at this stage -------------------------------------------------------------------------------- /src/dspygen/modules/dspygen_dsl_pipeline.py: -------------------------------------------------------------------------------- 1 | import yaml 2 | from dspygen.modules.dspygen_module import DGModule 3 | 4 | def process_yaml_pipeline(yaml_file): 5 | with open(yaml_file, 'r') as f: 6 | config = yaml.safe_load(f) 7 | 8 | result = None 9 | 10 | dg_modules = [] 11 | 12 | for module_def in config['dspy_modules']: 13 | module_class = globals()[f"{module_def['module']}DGModule"] # Get the module class by name 14 | module_instance = module_class(**module_def.get('args', {})) 15 | 16 | dg_modules.append(module_instance) 17 | 18 | # Pipe the dspy_modules together because we need to do __or__ operations 19 | for i in range(len(dg_modules) - 1): 20 | dg_modules[i] | dg_modules[i + 1] 21 | 22 | return dg_modules[-1].output 23 | 24 | 25 | def main(): 26 | from dspygen.utils.dspy_tools import init_dspy 27 | init_dspy() 28 | 29 | dsl_result = process_yaml_pipeline('pipeline.yaml') 30 | print(dsl_result) 31 | 32 | 33 | if __name__ == '__main__': 34 | main() 35 | -------------------------------------------------------------------------------- /src/dspygen/modules/example_file.js: -------------------------------------------------------------------------------- 1 | // example_file.js 2 | 3 | // Function to fetch user details 4 | function fetchUserDetails(userId) { 5 | const url = `https://api.example.com/users/${userId}`; 6 | const response = fetch(url).then(res => res.json()); 7 | return response; 8 | } 9 | 10 | // Class representing a User 11 | class User { 12 | constructor(id, name) { 13 | this.id = id; 14 | this.name = name; 15 | } 16 | 17 | greet() { 18 | return `Hello, my name is ${this.name}!`; 19 | } 20 | 21 | updateName(newName) { 22 | this.name = newName; 23 | } 24 | } 25 | 26 | // Function to log in a user 27 | function loginUser(username, password) { 28 | if (username === "admin" && password === "1234") { 29 | console.log("Login successful!"); 30 | return true; 31 | } else { 32 | console.log("Invalid credentials."); 33 | return false; 34 | } 35 | } 36 | 37 | // Helper function to display a message 38 | function displayMessage(message) { 39 | console.log(message); 40 | } 41 | -------------------------------------------------------------------------------- /src/dspygen/modules/gen_message_module.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | """ 4 | import dspy 5 | from dspygen.utils.dspy_tools import init_dspy 6 | 7 | 8 | class GenMessageModule(dspy.Module): 9 | """GenMessageModule""" 10 | 11 | def forward(self, prompt, message): 12 | pred = dspy.Predict("prompt, message -> pydantic_model_validate_str") 13 | result = pred(prompt=prompt, message=message).pydantic_model_validate_str 14 | return result 15 | 16 | 17 | from typer import Typer 18 | app = Typer() 19 | 20 | 21 | @app.command() 22 | def call(prompt, message): 23 | """GenMessageModule""" 24 | init_dspy() 25 | 26 | print(gen_message_call(prompt=prompt, message=message)) 27 | 28 | 29 | 30 | def gen_message_call(prompt, message): 31 | gen_message = GenMessageModule() 32 | return gen_message.forward(prompt=prompt, message=message) 33 | 34 | 35 | 36 | def main(): 37 | init_dspy() 38 | prompt = "" 39 | message = "" 40 | print(gen_message_call(prompt=prompt, message=message)) 41 | 42 | 43 | 44 | from fastapi import APIRouter 45 | router = APIRouter() 46 | 47 | @router.post("/gen_message/") 48 | async def gen_message_route(data: dict): 49 | # Your code generation logic here 50 | init_dspy() 51 | 52 | print(data) 53 | return gen_message_call(**data) 54 | 55 | 56 | 57 | if __name__ == "__main__": 58 | main() 59 | -------------------------------------------------------------------------------- /src/dspygen/modules/hello_world_module.yaml: -------------------------------------------------------------------------------- 1 | signature: "hello, goodbye -> translation, reasoning" 2 | predictor: ChainOfThought 3 | args: 4 | - hello: "French man" 5 | - goodbye: "French woman" -------------------------------------------------------------------------------- /src/dspygen/modules/nuxt_page_module.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | """ 4 | import dspy 5 | from dspygen.utils.dspy_tools import init_dspy 6 | import os 7 | import subprocess 8 | 9 | 10 | class NuxtPageModule(dspy.Module): 11 | """NuxtPageModule""" 12 | 13 | def __init__(self, **forward_args): 14 | super().__init__() 15 | self.forward_args = forward_args 16 | self.output = None 17 | 18 | def forward(self, requirements): 19 | pred = dspy.Predict("requirements -> nuxt_page_name") 20 | self.output = pred(requirements=requirements).nuxt_page_name 21 | return self.output 22 | 23 | 24 | def nuxt_page_name_call(requirements): 25 | nuxt_page_name = NuxtPageModule() 26 | return nuxt_page_name.forward(requirements=requirements) 27 | 28 | 29 | def main(): 30 | init_dspy() 31 | requirements = "Todo List" 32 | result = nuxt_page_name_call(requirements=requirements) 33 | print(result) 34 | # Trigger the generation with the result as the name argument 35 | generate_nuxt_page(result) 36 | 37 | 38 | def generate_nuxt_page(page_name): 39 | os.chdir(os.path.expanduser('~/dev/nuxtgen')) 40 | subprocess.run(['hygen', 'page', 'new', page_name]) 41 | 42 | 43 | if __name__ == "__main__": 44 | main() 45 | -------------------------------------------------------------------------------- /src/dspygen/modules/pipeline.yaml: -------------------------------------------------------------------------------- 1 | modules: 2 | - module: BusinessDevConsultant 3 | args: 4 | prompt: "3 Paragraph example speech on the future of a AGI Agent Swarm Business" 5 | - module: TextSummary 6 | - module: Tweet 7 | args: 8 | style: "business with a hint of humor and 5 hashtags" 9 | - module: ReactJsx 10 | args: 11 | reqs: "React, TypeScript, Material-UI, Axios" 12 | -------------------------------------------------------------------------------- /src/dspygen/modules/prompt_function_call_module.py: -------------------------------------------------------------------------------- 1 | """ 2 | The `documentation` field is not provided. 3 | """ 4 | import dspy 5 | from typer import Typer 6 | from dspygen.utils.dspy_tools import init_dspy 7 | 8 | 9 | app = Typer() 10 | 11 | 12 | class PromptFunctionCallModule(dspy.Module): 13 | """PromptFunctionCallModule""" 14 | 15 | def forward(self, prompt): 16 | pred = dspy.Predict("prompt -> function_call") 17 | result = pred(prompt=prompt).function_call 18 | return result 19 | 20 | 21 | def prompt_function_call_call(prompt): 22 | prompt_function_call = PromptFunctionCallModule() 23 | return prompt_function_call.forward(prompt=prompt) 24 | 25 | 26 | @app.command() 27 | def call(prompt): 28 | """PromptFunctionCallModule""" 29 | init_dspy() 30 | 31 | print(prompt_function_call_call(prompt=prompt)) 32 | 33 | 34 | def main(): 35 | init_dspy() 36 | prompt = "" 37 | print(prompt_function_call_call(prompt=prompt)) 38 | 39 | 40 | if __name__ == "__main__": 41 | main() 42 | -------------------------------------------------------------------------------- /src/dspygen/modules/react_jsx_module.py: -------------------------------------------------------------------------------- 1 | import dspy 2 | from typer import Typer 3 | 4 | 5 | app = Typer(help="Create React JSX source code.") 6 | 7 | 8 | class PromptReactJsxModule(dspy.Module): 9 | 10 | """This is a DSPy Module that converts a prompt into react_jsx""" 11 | 12 | def forward(self, prompt): 13 | pred = dspy.Predict("prompt -> react_jsx") 14 | result = pred(prompt=prompt).react_jsx 15 | return result 16 | 17 | 18 | def main(): 19 | lm = dspy.OpenAI(max_tokens=500) 20 | dspy.settings.configure(lm=lm) 21 | 22 | prompt = "Hello World Functional Component" 23 | 24 | prompt_react_jsx = PromptReactJsxModule() 25 | print(prompt_react_jsx.forward(prompt=prompt)) 26 | 27 | 28 | @app.command() 29 | def module_test(prompt): 30 | """This is a DSPy Module that converts a prompt into react_jsx""" 31 | prompt_react_jsx = PromptReactJsxModule() 32 | 33 | print(prompt_react_jsx.forward(prompt=prompt)) 34 | 35 | 36 | if __name__ == "__main__": 37 | # app() 38 | main() 39 | -------------------------------------------------------------------------------- /src/dspygen/modules/request_contract_module.py: -------------------------------------------------------------------------------- 1 | import dspy 2 | from typer import Typer 3 | 4 | 5 | app = Typer() 6 | 7 | 8 | class RequestContractModule(dspy.Module): 9 | """Verbose Documentation for the DSPy Module""" 10 | 11 | def forward(self, request, chars: str = "500"): 12 | pred = dspy.Predict("contract_request, chars -> contract_fine_print") 13 | result = pred(contract_request=request, chars=chars).contract_fine_print 14 | return result 15 | 16 | 17 | def request_contract_call(request, chars="500"): 18 | request_contract = RequestContractModule() 19 | return request_contract.forward(request=request, chars=chars) 20 | 21 | 22 | @app.command() 23 | def module_test(request, chars="500"): 24 | """Verbose Documentation for the DSPy Module""" 25 | print(request_contract_call(request=request, chars=chars)) 26 | 27 | 28 | def main(): 29 | lm = dspy.OpenAI(max_tokens=500) 30 | dspy.settings.configure(lm=lm) 31 | 32 | request = "Employment contract to hire a Senior Principle Software Engineer for a Fortune 100 company" 33 | print(request_contract_call(request=request)) 34 | 35 | 36 | if __name__ == "__main__": 37 | main() 38 | -------------------------------------------------------------------------------- /src/dspygen/modules/sql_query_module.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | """ 4 | import dspy 5 | from typer import Typer 6 | from dspygen.utils.dspy_tools import init_dspy 7 | 8 | 9 | app = Typer() 10 | 11 | 12 | class SQLQueryModule(dspy.Module): 13 | """SQLQueryModule""" 14 | 15 | def forward(self, old_query): 16 | pred = dspy.Predict("old_query -> improved_query") 17 | result = pred(old_query=old_query).improved_query 18 | return result 19 | 20 | 21 | def sql_query_call(old_query): 22 | sql_query = SQLQueryModule() 23 | return sql_query.forward(old_query=old_query) 24 | 25 | 26 | @app.command() 27 | def call(old_query): 28 | """SQLQueryModule""" 29 | init_dspy() 30 | 31 | print(sql_query_call(old_query=old_query)) 32 | 33 | 34 | from fastapi import APIRouter 35 | router = APIRouter() 36 | 37 | @router.post("/sql_query/") 38 | async def sql_query_route(data: dict): 39 | # Your code generation logic here 40 | init_dspy() 41 | 42 | print(data) 43 | return sql_query_call(**data) 44 | 45 | 46 | def main(): 47 | init_dspy() 48 | old_query = "" 49 | print(sql_query_call(old_query=old_query)) 50 | 51 | 52 | if __name__ == "__main__": 53 | main() 54 | -------------------------------------------------------------------------------- /src/dspygen/modules/tax_return_agent.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | """ 4 | import dspy 5 | from typer import Typer 6 | from dspygen.utils.dspy_tools import init_dspy 7 | 8 | 9 | app = Typer() 10 | 11 | 12 | class TaxReturnAgentModule(dspy.Module): 13 | """TaxReturnAgentModule""" 14 | 15 | def forward(self, income): 16 | pred = dspy.ChainOfThought("income -> tax_return_advice") 17 | result = pred(income=income).tax_return_advice 18 | return result 19 | 20 | 21 | def tax_return_agent_call(income): 22 | tax_return_agent = TaxReturnAgentModule() 23 | return tax_return_agent.forward(income=income) 24 | 25 | 26 | @app.command() 27 | def call(income): 28 | """TaxReturnAgentModule""" 29 | init_dspy() 30 | 31 | print(tax_return_agent_call(income=income)) 32 | 33 | 34 | from fastapi import APIRouter 35 | router = APIRouter() 36 | 37 | @router.post("/tax_return_agent/") 38 | async def tax_return_agent_route(data: dict): 39 | # Your code generation logic here 40 | init_dspy() 41 | 42 | print(data) 43 | return tax_return_agent_call(**data) 44 | 45 | 46 | def main(): 47 | init_dspy() 48 | income = "$150,000 chennai india to USA" 49 | print(tax_return_agent_call(income=income)) 50 | 51 | 52 | if __name__ == "__main__": 53 | main() 54 | -------------------------------------------------------------------------------- /src/dspygen/modules/test.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | """ 4 | import dspy 5 | from typer import Typer 6 | from dspygen.utils.dspy_tools import init_dspy, init_ol 7 | 8 | 9 | app = Typer() 10 | 11 | 12 | class TestModule(dspy.Module): 13 | """TestModule""" 14 | 15 | def forward(self, a1, s2, v3): 16 | pred = dspy.Predict("a1, s2, v3 -> test") 17 | result = pred(a1=a1, s2=s2, v3=v3).test 18 | return result 19 | 20 | 21 | def test_call(a1, s2, v3): 22 | test = TestModule() 23 | return test.forward(a1=a1, s2=s2, v3=v3) 24 | 25 | 26 | @app.command() 27 | def call(a1, s2, v3): 28 | """TestModule""" 29 | init_dspy() 30 | 31 | print(test_call(a1=a1, s2=s2, v3=v3)) 32 | 33 | 34 | from fastapi import APIRouter 35 | router = APIRouter() 36 | 37 | @router.post("/test/") 38 | async def test_route(data: dict): 39 | # Your code generation logic here 40 | init_dspy() 41 | 42 | print(data) 43 | return test_call(**data) 44 | 45 | 46 | def main(): 47 | init_ol() 48 | a1 = "" 49 | s2 = "" 50 | v3 = "" 51 | print(test_call(a1=a1, s2=s2, v3=v3)) 52 | 53 | 54 | if __name__ == "__main__": 55 | main() 56 | -------------------------------------------------------------------------------- /src/dspygen/modules/text_summarizer_module.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | """ 4 | import dspy 5 | from dspy import Signature, InputField, OutputField 6 | 7 | 8 | class TextSummarization(Signature): 9 | """ 10 | Summarize a given text, capturing the main points concisely. 11 | """ 12 | text = InputField(desc="The original text to be summarized.") 13 | summary = OutputField(desc="The summary of the original text, capturing the main points concisely.") 14 | 15 | 16 | # Example usage within the existing TextSummarizerModule 17 | class TextSummarizerModule(dspy.Module): 18 | """TextSummarizerModule""" 19 | 20 | def __init__(self, **forward_args): 21 | super().__init__() 22 | self.forward_args = forward_args 23 | self.output = None 24 | 25 | def forward(self, text): 26 | pred = dspy.Predict(TextSummarization) 27 | self.output = pred(text=text).summary 28 | return self.output 29 | 30 | 31 | def text_summarizer_call(text): 32 | text_summarizer = TextSummarizerModule() 33 | return text_summarizer.forward(text=text) 34 | 35 | 36 | def main(): 37 | from dspygen.utils.dspy_tools import init_dspy 38 | init_dspy() 39 | text = "Hello World" 40 | result = text_summarizer_call(text=text) 41 | print(result) 42 | 43 | 44 | if __name__ == "__main__": 45 | main() 46 | -------------------------------------------------------------------------------- /src/dspygen/modules/text_summary_module_module.py: -------------------------------------------------------------------------------- 1 | import dspy 2 | from typer import Typer 3 | 4 | 5 | app = Typer() 6 | 7 | 8 | class TextSummaryModuleModule(dspy.Module): 9 | """A DSPy Module that takes in text and produces a summary.""" 10 | 11 | def forward(self, text): 12 | pred = dspy.Predict("text -> summary") 13 | result = pred(text=text).summary 14 | return result 15 | 16 | 17 | def text_summary_module_call(text): 18 | text_summary_module = TextSummaryModuleModule() 19 | return text_summary_module.forward(text=text) 20 | 21 | 22 | def main(): 23 | lm = dspy.OpenAI(max_tokens=500) 24 | dspy.settings.configure(lm=lm) 25 | 26 | text = "" 27 | print(text_summary_module_call(text=text)) 28 | 29 | 30 | @app.command() 31 | def module_test(text): 32 | """A DSPy Module that takes in text and produces a summary.""" 33 | print(text_summary_module_call(text=text)) 34 | 35 | 36 | if __name__ == "__main__": 37 | app() 38 | # main() 39 | -------------------------------------------------------------------------------- /src/dspygen/pages/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/pages/__init__.py -------------------------------------------------------------------------------- /src/dspygen/pages/hello.py: -------------------------------------------------------------------------------- 1 | import streamlit as st 2 | from st_pages import add_page_title 3 | 4 | from dspygen.modules.streamlit_bot_module import streamlit_bot_call 5 | from dspygen.utils.dspy_tools import init_dspy 6 | 7 | add_page_title() 8 | 9 | 10 | # Streamlit form and display 11 | st.title("StreamlitBotModule Generator") 12 | project = st.text_input("Enter project") 13 | page = st.text_input("Enter page") 14 | 15 | if st.button("Submit StreamlitBotModule"): 16 | init_dspy() 17 | 18 | result = streamlit_bot_call(project=project, page=page) 19 | st.code(result) -------------------------------------------------------------------------------- /src/dspygen/pages/remodeling.py: -------------------------------------------------------------------------------- 1 | import streamlit as st 2 | from st_pages import add_page_title 3 | 4 | from dspygen.modules.streamlit_bot_module import streamlit_bot_call 5 | from dspygen.utils.dspy_tools import init_dspy 6 | 7 | add_page_title() 8 | 9 | 10 | # Streamlit form and display 11 | st.title("StreamlitBotModule Generator") 12 | project = st.text_input("Enter project") 13 | page = st.text_input("Enter page") 14 | 15 | if st.button("Submit StreamlitBotModule"): 16 | init_dspy() 17 | 18 | result = streamlit_bot_call(project=project, page=page) 19 | st.code(result) -------------------------------------------------------------------------------- /src/dspygen/prototypes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/prototypes/__init__.py -------------------------------------------------------------------------------- /src/dspygen/prototypes/state_chat/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/prototypes/state_chat/__init__.py -------------------------------------------------------------------------------- /src/dspygen/prototypes/tai/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/prototypes/tai/__init__.py -------------------------------------------------------------------------------- /src/dspygen/pyautomator/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/pyautomator/__init__.py -------------------------------------------------------------------------------- /src/dspygen/pyautomator/calendar/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/pyautomator/calendar/__init__.py -------------------------------------------------------------------------------- /src/dspygen/pyautomator/calendar/generated_event.ics: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | 3 | VERSION:2.0 4 | 5 | PRODID:-//dspygen//CalendarEvent//EN 6 | 7 | CALSCALE:GREGORIAN 8 | 9 | BEGIN:VEVENT 10 | 11 | UID:20240828T130000Z-001@example.com 12 | 13 | DTSTAMP:20240828T130000Z 14 | 15 | SUMMARY:Quarterly Project Review 16 | 17 | DESCRIPTION:Team meeting to discuss project review and planning. 18 | 19 | LOCATION:Conference Room A 20 | 21 | DTSTART:20240831T140000Z 22 | 23 | DTEND:20240831T153000Z 24 | 25 | ORGANIZER;CN=David Miller:mailto:david@example.com 26 | 27 | ATTENDEE;CN=Alice Smith;RSVP=TRUE:mailto:alice@example.com 28 | 29 | ATTENDEE;CN=Bob Johnson;RSVP=TRUE:mailto:bob@example.com 30 | 31 | BEGIN:VALARM 32 | 33 | TRIGGER:-PT15M 34 | 35 | DESCRIPTION:Reminder: Quarterly Project Review 36 | 37 | ACTION:DISPLAY 38 | 39 | END:VALARM 40 | 41 | END:VEVENT 42 | 43 | END:VCALENDAR -------------------------------------------------------------------------------- /src/dspygen/pyautomator/contacts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/pyautomator/contacts/__init__.py -------------------------------------------------------------------------------- /src/dspygen/pyautomator/event_kit/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/pyautomator/event_kit/__init__.py -------------------------------------------------------------------------------- /src/dspygen/pyautomator/keynote/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/pyautomator/keynote/__init__.py -------------------------------------------------------------------------------- /src/dspygen/pyautomator/linkedin/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/pyautomator/linkedin/__init__.py -------------------------------------------------------------------------------- /src/dspygen/pyautomator/mail/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/pyautomator/mail/__init__.py -------------------------------------------------------------------------------- /src/dspygen/pyautomator/reminders/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/pyautomator/reminders/__init__.py -------------------------------------------------------------------------------- /src/dspygen/pyautomator/reminders/wintermute_reminder.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | from dspygen.pyautomator.event_kit.reminder import Reminder 4 | from dspygen.utils.dspy_tools import init_dspy 5 | from dspygen.modules.comment_module import comment_call 6 | 7 | def update_message(reminder): 8 | """Update the message based on the current notes using comment_call""" 9 | print(f"Updating message for reminder: {reminder.ci_id}") 10 | # Assuming the reminder's title is stored in a 'title' attribute 11 | # If not, you may need to adjust this part 12 | updated_message = comment_call(vid_title=reminder.title, words=reminder.notes) 13 | reminder.notes = updated_message 14 | reminder.save() 15 | 16 | 17 | 18 | def main(): 19 | """Main function""" 20 | init_dspy() 21 | 22 | wintermute = Reminder.from_id(reminder_id="AACB789A-9234-4216-94D9-626DDBF25A02") 23 | print(wintermute) 24 | 25 | update_message(wintermute) 26 | 27 | 28 | if __name__ == '__main__': 29 | main() 30 | -------------------------------------------------------------------------------- /src/dspygen/pyautomator/safari/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/pyautomator/safari/__init__.py -------------------------------------------------------------------------------- /src/dspygen/rdddy/__init__.py: -------------------------------------------------------------------------------- 1 | """dspygen package.""" 2 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/base_aggregate.py: -------------------------------------------------------------------------------- 1 | from dspygen.rdddy.base_inhabitant import BaseInhabitant 2 | 3 | 4 | class BaseAggregate(BaseInhabitant): 5 | """Serves as the cornerstone of the domain model within the RDDDY framework, encapsulating a cluster of domain 6 | objects that are treated as a single unit for the purposes of data changes. An aggregate guarantees the 7 | consistency of changes to the domain objects it encompasses by enforcing invariants across the entire group, 8 | making it a critical element in maintaining the integrity and boundaries of the domain model. By extending 9 | BaseAggregate, developers can define the core logic that governs the state and behavior of an aggregate root 10 | and its associated entities and value objects. This approach not only aids in isolating domain logic from 11 | infrastructure concerns but also supports the implementation of complex business rules and transactions in a way 12 | that aligns with the principles of Domain-Driven Design. Aggregates are pivotal in ensuring that domain logic 13 | remains both encapsulated and correctly partitioned, facilitating a clear and maintainable domain model that can 14 | evolve over time with the business requirements.""" 15 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/base_command.py: -------------------------------------------------------------------------------- 1 | from dspygen.rdddy.base_message import BaseMessage 2 | 3 | 4 | class BaseCommand(BaseMessage): 5 | """AbstractCommand message type.""" 6 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/base_event.py: -------------------------------------------------------------------------------- 1 | from dspygen.rdddy.base_message import BaseMessage 2 | 3 | 4 | class BaseEvent(BaseMessage): 5 | """Event message type.""" 6 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/base_policy.py: -------------------------------------------------------------------------------- 1 | from dspygen.rdddy.base_inhabitant import BaseInhabitant 2 | 3 | 4 | class BasePolicy(BaseInhabitant): 5 | """Outlines the framework for decision-making logic that governs the system's operations, translating business 6 | rules and conditions into actionable guidance. Policies play a crucial role in defining the behavior of the 7 | system under various circumstances, ensuring that operations adhere to the defined business logic and 8 | constraints. Through extending AbstractPolicy, developers can encapsulate and enforce the strategic and 9 | operational rules that drive the domain's functionality, ensuring consistency and alignment with business 10 | objectives.""" 11 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/base_query.py: -------------------------------------------------------------------------------- 1 | from dspygen.rdddy.base_message import BaseMessage 2 | 3 | 4 | class BaseQuery(BaseMessage): 5 | """Query message type.""" 6 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/base_read_model.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel 2 | 3 | 4 | class BaseReadModel(BaseModel): 5 | """Base class for read models, providing a template for querying data from the domain model.""" 6 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/base_saga.py: -------------------------------------------------------------------------------- 1 | from dspygen.rdddy.base_inhabitant import BaseInhabitant 2 | 3 | 4 | class BaseSaga(BaseInhabitant): 5 | """Encapsulates the logic for managing long-running, complex business transactions that span multiple services or 6 | bounded contexts. It provides mechanisms for orchestrating sequences of domain events and commands, 7 | ensuring transactional consistency and compensating actions in case of failures. By extending AbstractSaga, 8 | developers can implement coordinated workflows that are robust and aligned with business processes. 9 | """ 10 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/base_task.py: -------------------------------------------------------------------------------- 1 | class BaseTask: 2 | """Outlines the structure for tasks, which are discrete units of logic executed as part of the 3 | system's operations. Tasks encapsulate specific behaviors or processes, such as validation, computation, 4 | or state transitions, facilitating modularity and reuse. By defining tasks as subclasses of AbstractTask, 5 | the system can orchestrate complex operations while maintaining clarity and separation of concerns. 6 | """ 7 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/base_value_object.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel, ConfigDict 2 | from typing import Any 3 | 4 | 5 | class BaseValueObject(BaseModel): 6 | model_config = ConfigDict(frozen=True, arbitrary_types_allowed=True) 7 | 8 | # Example of a method that might be common across all value objects 9 | def __eq__(self, other: Any) -> bool: 10 | if isinstance(other, self.__class__): 11 | return self.model_dump() == other.model_dump() 12 | return False 13 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/base_view.py: -------------------------------------------------------------------------------- 1 | class BaseView: 2 | """serves as the foundation for user interface components in a reactive system. It outlines methods for rendering 3 | data to the user and reacting to user inputs, enabling the development of dynamic and responsive user interfaces. 4 | Subclasses of AbstractView are tailored to specific UI requirements, responding to changes in the application's 5 | state with real-time updates.""" 6 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/browser/__init__.py: -------------------------------------------------------------------------------- 1 | """dspygen package.""" 2 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/browser/run_chatgpt.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | 4 | async def main(): 5 | print("main") 6 | # await 7 | 8 | 9 | if __name__ == "__main__": 10 | asyncio.run(main()) 11 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/demo_inhabitant.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/rdddy/demo_inhabitant.py -------------------------------------------------------------------------------- /src/dspygen/rdddy/domain_exception.py: -------------------------------------------------------------------------------- 1 | class DomainException(Exception): 2 | """Acts as a base class for defining domain-specific exceptions. These exceptions are used to signal error 3 | conditions in a way that is meaningful within the domain context, providing clear and actionable feedback to the 4 | system or the end-user. Custom exceptions derived from DomainException enhance error handling by incorporating 5 | domain-relevant information and context.""" 6 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/event_storm_model.py: -------------------------------------------------------------------------------- 1 | from pydantic import Field, BaseModel 2 | 3 | from dspygen.rdddy.base_event import BaseEvent 4 | from dspygen.utils.dspy_tools import init_dspy 5 | 6 | 7 | class EventStormingDomainSpecificationModel(BaseModel): 8 | """Integrates Event Storming with RDDDY and DFLSS to capture and analyze domain complexities through events, commands, and queries, using Hoare logic for correctness. It serves as a repository for interactions identified in Event Storming, enhancing system responsiveness and process efficiency. This model educates on designing and verifying systems aligned with domain requirements and operational excellence. CamelCase only. """ 9 | 10 | domain_events: list[BaseEvent] = Field( 11 | ..., 12 | min_length=3, 13 | description="List of domain events triggering system reactions. Examples: 'OrderPlaced', 'PaymentProcessed', 'InventoryUpdated'.", 14 | ) 15 | 16 | def main(): 17 | init_dspy() 18 | 19 | from dspygen.modules.gen_pydantic_instance import instance 20 | inst = instance(EventStormingDomainSpecificationModel, "Shipping System") 21 | print(inst) 22 | 23 | 24 | if __name__ == '__main__': 25 | main() 26 | -------------------------------------------------------------------------------- /src/dspygen/rdddy/inhabitant/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/rdddy/inhabitant/__init__.py -------------------------------------------------------------------------------- /src/dspygen/rm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanchatmangpt/dspygen/69f305d08fc10f31867fb2d3d2c755891dffa99e/src/dspygen/rm/__init__.py -------------------------------------------------------------------------------- /src/dspygen/rm/chatgpt_string_retriever.py: -------------------------------------------------------------------------------- 1 | import ijson 2 | 3 | from dspygen.rm.chatgpt_chromadb_retriever import Conversation, Data 4 | from dspygen.utils.file_tools import data_dir 5 | 6 | 7 | def _process_and_store_conversations(match): 8 | with open(data_dir("conversations.json"), "rb") as json_file: 9 | for conversation in ijson.items(json_file, "item"): 10 | try: 11 | validated_conversation = Conversation(**conversation) 12 | for _, data in validated_conversation.mapping.items(): 13 | validated_data = Data(**data) 14 | if validated_data.message: 15 | document_text = ' '.join(part for part in validated_data.message.content.parts if part) 16 | if match in document_text and validated_data.author.role == "assistant": 17 | with open(match + ".txt", "a") as file: 18 | file.write(document_text + "\n") 19 | except Exception as e: 20 | continue 21 | 22 | 23 | def main(): 24 | """Main function""" 25 | match = "Retriever" 26 | _process_and_store_conversations(match) 27 | 28 | 29 | if __name__ == '__main__': 30 | main() 31 | 32 | -------------------------------------------------------------------------------- /src/dspygen/rm/natural_language_data_retriever.py: -------------------------------------------------------------------------------- 1 | import dspy 2 | 3 | 4 | class NaturalLanguageDataRetriever(dspy.Retrieve): 5 | def __init__(self, **kwargs): 6 | super().__init__() 7 | 8 | def forward(self, **kwargs): 9 | return None 10 | 11 | 12 | def main(): 13 | rm = NaturalLanguageDataRetriever() 14 | print(rm.forward()) 15 | 16 | 17 | if __name__ == '__main__': 18 | main() 19 | -------------------------------------------------------------------------------- /src/dspygen/rm/web_retriever.py: -------------------------------------------------------------------------------- 1 | import dspy 2 | 3 | 4 | class WebRetriever(dspy.Retrieve): 5 | def __init__(self, source, **kwargs): 6 | super().__init__() 7 | 8 | self.source = source 9 | 10 | def forward(self, query, **kwargs): 11 | return None 12 | 13 | 14 | def main(): 15 | rm = WebRetriever(source="
17 | 18 |

{customInstructions}

19 | 20 | ); 21 | }; 22 | ``` -------------------------------------------------------------------------------- /tests/document download.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | 3 | const DocumentDownload = () => { 4 | const [downloaded, setDownloaded] = useState(false); 5 | 6 | useEffect(() => { 7 | if (downloaded) { 8 | // download the document 9 | } 10 | }, [downloaded]); 11 | 12 | return ( 13 |
14 |

Document Download

15 | 16 |
17 | ); 18 | }; 19 | 20 | export default DocumentDownload; -------------------------------------------------------------------------------- /tests/document upload.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | 3 | interface DocumentUploadProps { 4 | onUpload: (file: File) => void; 5 | onCancel: () => void; 6 | } 7 | 8 | const DocumentUpload: React.FC = ({ 9 | onUpload, 10 | onCancel, 11 | }) => { 12 | const [selectedFiles, setSelectedFiles] = useState([]); 13 | 14 | const handleFileChange = (event: React.ChangeEvent) => { 15 | const files = event.target.files; 16 | if (files) { 17 | setSelectedFiles((prevFiles) => [...prevFiles, ...files]); 18 | } 19 | }; 20 | 21 | const handleUpload = () => { 22 | selectedFiles.forEach((file) => onUpload(file)); 23 | }; 24 | 25 | const handleCancel = () => { 26 | setSelectedFiles([]); 27 | onCancel(); 28 | }; 29 | 30 | return ( 31 |
32 | 33 | 34 | 35 |
36 | ); 37 | }; 38 | ``` -------------------------------------------------------------------------------- /tests/drag-and-drop document upload.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | 3 | const DragAndDropDocumentUpload = () => { 4 | const [document, setDocument] = useState(null); 5 | 6 | const handleDrop = (e) => { 7 | e.preventDefault(); 8 | const file = e.dataTransfer.files[0]; 9 | setDocument(file); 10 | }; 11 | 12 | const handleDragOver = (e) => { 13 | e.preventDefault(); 14 | }; 15 | 16 | return ( 17 |
22 | {document &&

{document.name}

} 23 |
24 | ); 25 | }; 26 | 27 | export default DragAndDropDocumentUpload; 28 | ``` -------------------------------------------------------------------------------- /tests/email confirmation to sender.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | 3 | interface EmailConfirmationProps { 4 | sender: string; 5 | email: string; 6 | } 7 | 8 | const EmailConfirmation: React.FC = ({ 9 | sender, 10 | email, 11 | }) => { 12 | const [confirmation, setConfirmation] = useState(false); 13 | 14 | useEffect(() => { 15 | if (email) { 16 | setConfirmation(true); 17 | } 18 | }, [email]); 19 | 20 | return ( 21 |
22 |

Email Confirmation

23 |

24 | {sender} has sent an email to {email} 25 |

26 | {confirmation &&

You have received a confirmation email

} 27 |
28 | ); 29 | }; 30 | 31 | export default EmailConfirmation; -------------------------------------------------------------------------------- /tests/http/convo_rest.http: -------------------------------------------------------------------------------- 1 | ### Test: Standard Greeting 2 | GET http://localhost:8000/?user_input=Hi%2C%20how%20are%20you%3F 3 | 4 | ### Test: Asking for Help 5 | GET http://localhost:8000/?user_input=Can%20you%20help%20me%20with%20my%20project%3F 6 | 7 | ### Test: Long and Complex Query 8 | GET http://localhost:8000/?user_input=I'm%20looking%20for%20information%20on%20quantum%20computing%20and%20its%20applications%20in%20cryptography.%20Can%20you%20provide%20some%20insights%3F 9 | 10 | ### Test: Inappropriate Content 11 | GET http://localhost:8000/?user_input=Something%20inappropriate 12 | 13 | ### Test: Non-English Characters 14 | GET http://localhost:8000/?user_input=%E4%BD%A0%E5%A5%BD%EF%BC%8C%E4%BB%8A%E5%A4%A9%E6%98%AF%E4%BB%80%E4%B9%88%E6%97%A5%E5%AD%90%EF%BC%9F 15 | 16 | ### Test: Empty Message 17 | GET http://localhost:8000/?user_input= 18 | 19 | ### Test: Special Characters 20 | GET http://localhost:8000/?user_input=!@%23$%25^&*()_%2B%3D-%5B%5D%7B%7D%7C%3B'%3A%22%2C.%3C%3E%3F%2F 21 | 22 | -------------------------------------------------------------------------------- /tests/http/test.http: -------------------------------------------------------------------------------- 1 | POST http://127.0.0.1:8000/book_appointment/ HTTP/1.1 2 | Content-Type: application/json 3 | 4 | { 5 | "requested_date": "friday", 6 | "availability": "saturday" 7 | } 8 | ### 9 | POST http://127.0.0.1:8000/book_appointment/ HTTP/1.1 10 | Content-Type: application/json 11 | 12 | { 13 | "requested_date": "friday", 14 | "availability": "friday" 15 | } 16 | ### 17 | POST http://127.0.0.1:8000/chat_bot/ HTTP/1.1 18 | Content-Type: application/json 19 | 20 | { 21 | "message": "I have a problem with my order? Where is it?", 22 | "history": "Order # 234293847, Gallon of Personal Lubricant. Delayed due to shipping container in customs", 23 | "context": "customer service bot conversation" 24 | } 25 | ### 26 | POST http://127.0.0.1:8000/jsx/ HTTP/1.1 27 | Content-Type: application/json 28 | 29 | { 30 | "story": "Newsletter contact signup form JSX source code" 31 | } 32 | 33 | ### 34 | POST http://127.0.0.1:8000/js_to_fast_api/ HTTP/1.1 35 | Content-Type: application/json 36 | 37 | { 38 | "js_source": "Booking appointment" 39 | } 40 | 41 | ### 42 | POST http://127.0.0.1:8000/html/ HTTP/1.1 43 | Content-Type: application/json 44 | 45 | { 46 | "user_input": "Newsletter contact signup form" 47 | } -------------------------------------------------------------------------------- /tests/http/test_pipeline.http: -------------------------------------------------------------------------------- 1 | POST http://127.0.0.1:8888/execute_pipeline/ 2 | Content-Type: application/json 3 | 4 | { 5 | "yaml_content": "context:\n celebrity: \"Nicolas Cage\"\n\nmodels:\n - label: \"default\"\n name: \"OpenAI\"\n\nmodules:\n - name: \"BlogModule\"\n signature: \"dspygen.signatures.blog_article.BlogArticle\"\n predictor: \"Predict\"\n model: \"default\"\n args:\n - name: \"celebrity\"\n - name: \"news\"\n\nsteps:\n - module: \"BlogModule\"\n args:\n celebrity: \"{{ celebrity }}\"\n news: \"{{ news }}\"", 6 | "init_ctx": { 7 | "news": "$12,500 Retainer Contract" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/link expiration.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | 3 | interface Props { 4 | expirationDate: Date; 5 | link: string; 6 | } 7 | 8 | const LinkExpiration: React.FC = ({ expirationDate, link }) => { 9 | const [isExpired, setIsExpired] = useState(false); 10 | 11 | useEffect(() => { 12 | const currentDate = new Date(); 13 | if (currentDate > expirationDate) { 14 | setIsExpired(true); 15 | } 16 | }, [expirationDate]); 17 | 18 | return ( 19 |
20 | {isExpired ? ( 21 |

The link has expired

22 | ) : ( 23 | 24 | {link} 25 | 26 | )} 27 |
28 | ); 29 | }; 30 | 31 | export default LinkExpiration; 32 | ``` -------------------------------------------------------------------------------- /tests/pipeline/data_hello_world_pipeline.yaml: -------------------------------------------------------------------------------- 1 | rm_models: 2 | - label: "data_retriever" 3 | name: "DataRetriever" 4 | 5 | steps: 6 | - module: "HelloWorldModule" 7 | rm_model: "data_retriever" 8 | args: 9 | file_path: "{{ csv_file }}" 10 | return_columns: ["id", "name"] 11 | -------------------------------------------------------------------------------- /tests/retrievers/test_textfileretriever.py: -------------------------------------------------------------------------------- 1 | # import pytest 2 | # 3 | # from dspygen.rm.doc_retriever import DocRetriever 4 | # 5 | # # Define the path to your test files 6 | # TEST_FILES_PATH = "test_files/" 7 | # 8 | # # List of test cases, each case is a tuple: (filename, expected unique phrase) 9 | # test_cases = [ 10 | # ("sample.txt", "uniquephrase"), 11 | # ("sample.md", "uniquephrase"), 12 | # ("sample.pdf", "uniquephrase"), 13 | # ("sample.docx", "uniquephrase"), 14 | # ("sample.html", "uniquephrase") 15 | # ] 16 | # 17 | # 18 | # 19 | # @pytest.mark.parametrize("file_name, expected_phrase", test_cases) 20 | # def test_text_file_retriever(file_name, expected_phrase): 21 | # """ 22 | # Test TextFileRetriever for various text file types. 23 | # """ 24 | # file_path = TEST_FILES_PATH + file_name 25 | # retriever = DocRetriever([file_path], search_query=expected_phrase) 26 | # results = retriever.forward() 27 | # 28 | # assert len(results) > 0, "No results returned." 29 | # for result in results: 30 | # assert expected_phrase in result["text"], f"{expected_phrase} not found in {file_name}." 31 | # 32 | # if __name__ == "__main__": 33 | # pytest.main() 34 | -------------------------------------------------------------------------------- /tests/signature validation.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | 3 | interface SignatureValidationProps { 4 | document: Document; 5 | } 6 | 7 | const SignatureValidation: React.FC = ({ document }) => { 8 | const [signature, setSignature] = useState(null); 9 | const [isValid, setIsValid] = useState(null); 10 | 11 | useEffect(() => { 12 | setSignature(document.signature); 13 | }, [document]); 14 | 15 | const validateSignature = () => { 16 | if (signature) { 17 | setIsValid(signature.isValid); 18 | } 19 | }; 20 | 21 | return ( 22 |
23 |

Signature Validation

24 |

Document: {document.name}

25 |

Signature: {signature ? signature.name : 'No signature found'}

26 | 27 | {isValid !== null &&

Signature is {isValid ? 'valid' : 'invalid'}

} 28 |
29 | ); 30 | }; 31 | 32 | export default SignatureValidation; 33 | ``` -------------------------------------------------------------------------------- /tests/test_advanced_integration_job_search_workflow.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/test_api.py: -------------------------------------------------------------------------------- 1 | """Test dspygen REST API.""" 2 | 3 | import httpx 4 | from fastapi import Depends 5 | from fastapi.testclient import TestClient 6 | 7 | from dspygen.api import app, get_service_colony 8 | from dspygen.rdddy.service_colony import ServiceColony 9 | 10 | client = TestClient(app) 11 | 12 | 13 | # def test_read_root(asys: ServiceColony = Depends(get_service_colony)) -> None: 14 | # """Test that reading the root is successful.""" 15 | # response = client.get("/") 16 | # assert httpx.codes.is_success(response.status_code) 17 | -------------------------------------------------------------------------------- /tests/test_chatgpt_integration.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from unittest.mock import patch 3 | from dspygen.chatgpt_integration import send_message_to_chatgpt 4 | 5 | 6 | def test_send_message_to_chatgpt(): 7 | mock_response = { 8 | "choices": [ 9 | {"message": {"content": "This is a test response"}} 10 | ] 11 | } 12 | with patch('openai.ChatCompletion.create') as mock_create: 13 | mock_create.return_value = mock_response 14 | response = send_message_to_chatgpt("Test message") 15 | assert response == "This is a test response" 16 | -------------------------------------------------------------------------------- /tests/test_cli.py: -------------------------------------------------------------------------------- 1 | """Test dspygen CLI.""" 2 | 3 | from typer.testing import CliRunner 4 | 5 | from dspygen.cli import app 6 | 7 | runner = CliRunner() 8 | 9 | 10 | # def test_init() -> None: 11 | # """Test that the say command works as expected.""" 12 | # result = runner.invoke(app, ["init", "hello-world-project"]) 13 | # assert result.exit_code == 0 14 | # 15 | # 16 | # def test_bad_init() -> None: 17 | # """Test that the say command works as expected.""" 18 | # result = runner.invoke(app, ["init"]) 19 | # assert result.exit_code == 2 20 | -------------------------------------------------------------------------------- /tests/test_event_kit_service_integration.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/test_import.py: -------------------------------------------------------------------------------- 1 | """Test dspygen.""" 2 | 3 | import dspygen 4 | 5 | 6 | def test_import() -> None: 7 | """Test that the package can be imported.""" 8 | assert isinstance(dspygen.__name__, str) 9 | -------------------------------------------------------------------------------- /tests/test_init.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from typer.testing import CliRunner 3 | 4 | from dspygen.cli import app 5 | 6 | runner = CliRunner() 7 | 8 | 9 | @pytest.mark.parametrize("project_name", [ 10 | " projectWithSpaceAtStart", 11 | "projectWithSpaceAtEnd ", 12 | "project with space", 13 | "project__with__doubleunderscore", 14 | "project--with--doublehyphen", 15 | "-projectWithHyphenAtStart", 16 | "projectWithHyphenAtEnd-", 17 | "_projectWithUnderscoreAtStart", 18 | "projectWithUnderscoreAtEnd_", 19 | "-projectWithHyphenAtStart", 20 | "_projectWithUnderscoreAtStart", 21 | ]) 22 | def test_init_invalid_names(project_name): 23 | result = runner.invoke(app, ["init", project_name]) 24 | assert result.exit_code != 0 25 | -------------------------------------------------------------------------------- /tests/test_reminder_app.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/test_web_scraper.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | import httpx 3 | from dspygen.web_scraper import scrape_website 4 | 5 | @pytest.mark.asyncio 6 | async def test_scrape_website(httpx_mock): 7 | url = "http://example.com" 8 | httpx_mock.add_response(method="GET", url=url, text='Test Page') 9 | 10 | title = await scrape_website(url) 11 | assert title == "Test Page" 12 | -------------------------------------------------------------------------------- /tests/workflow/test_control_flow.py: -------------------------------------------------------------------------------- 1 | from dspygen.workflow.workflow_models import Workflow 2 | from dspygen.workflow.workflow_executor import execute_workflow 3 | 4 | 5 | # def test_workflow(): 6 | # wf = Workflow.from_yaml("/Users/sac/dev/dspygen/src/dspygen/workflow/control_flow_workflow.yaml") 7 | # context = execute_workflow(wf) 8 | # print(context) 9 | 10 | 11 | # def test_import_workflow(): 12 | # wf = Workflow.from_yaml("/Users/sac/dev/dspygen/src/dspygen/workflow/data_analysis_workflow.yaml") 13 | # context = execute_workflow(wf) 14 | # print(context) 15 | --------------------------------------------------------------------------------