Skip to content

Commit

Permalink
Adding inhabitant specs
Browse files Browse the repository at this point in the history
  • Loading branch information
seanchatmangpt committed Sep 4, 2024
1 parent 3da36a9 commit 2084b14
Show file tree
Hide file tree
Showing 51 changed files with 5,475 additions and 180 deletions.
2 changes: 1 addition & 1 deletion module_script.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Create DSPyGen modules required for the Bullwhip platform
# Create DSPyGen dspy_modules required for the Bullwhip platform
echo "Creating DSPyGen modules for Bullwhip platform..."

# Example 1: Create a module to transform JSON data to a structured report
Expand Down
3 changes: 2 additions & 1 deletion src/dspygen/agents/challenger_agent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
from enum import Enum, auto
from dspygen.mixin.fsm.fsm_mixin import FSMMixin, trigger
from dspygen.rdddy.base_inhabitant import BaseInhabitant


class SalesState(Enum):
Expand All @@ -14,7 +15,7 @@ class SalesState(Enum):
COMPLETING = auto()


class ChallengerSalesAgent(FSMMixin):
class ChallengerSalesAgent(FSMMixin, BaseInhabitant):
def __init__(self):
super().__init__()
self.setup_fsm(state_enum=SalesState, initial=SalesState.INITIALIZING)
Expand Down
2 changes: 1 addition & 1 deletion src/dspygen/agents/research_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from dspygen.mixin.fsm.fsm_mixin import FSMMixin, trigger
from dspygen.modules.condition_sufficient_info_module import condition_sufficient_info_call
from dspygen.modules.query_generator_module import query_generator_call
#from dspygen.modules.refine_results_module import refine_results_module_call
#from dspygen.dspy_modules.refine_results_module import refine_results_module_call
from dspygen.modules.source_selector_module import source_selector_call
from dspygen.utils.scraping_tools import execute_brave_search_queries, scrape_urls, execute_duckduckgo_queries

Expand Down
38 changes: 19 additions & 19 deletions src/dspygen/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ def init(project_name: str = typer.Argument(...),


TUTOR_CONTEXT = """DSPyGen: AI Development Simplified
DSPyGen revolutionizes AI development by bringing the "Convention over Configuration" philosophy to language model (LM) pipelines. Inspired by Ruby on Rails, it offers a CLI for creating, developing, and deploying with DSPy modules, emphasizing quick setup and modular design for streamlined project workflows.
DSPyGen revolutionizes AI development by bringing the "Convention over Configuration" philosophy to language model (LM) pipelines. Inspired by Ruby on Rails, it offers a CLI for creating, developing, and deploying with DSPy dspy_modules, emphasizing quick setup and modular design for streamlined project workflows.
Key Features:
Quick Initialization: Rapidly configure your AI project, mirroring the simplicity of Ruby on Rails.
Modular Design: Generate and enhance DSPy modules with ease, promoting a scalable and flexible development environment.
Modular Design: Generate and enhance DSPy dspy_modules with ease, promoting a scalable and flexible development environment.
User-Friendly Commands: Manage your AI projects effortlessly through an intuitive command structure.
Chatbot Assistance: Embedded support to guide through the development process, enhancing user experience.
Using DSPyGen Modules:
DSPyGen's core lies in its modules, designed for seamless integration and code optimization. Here’s how to leverage them:
DSPyGen's core lies in its dspy_modules, designed for seamless integration and code optimization. Here’s how to leverage them:
dspygen is a command-line tool.
It helps generate various components for a project.
Expand All @@ -134,34 +134,34 @@ def init(project_name: str = typer.Argument(...),
help: Provides assistance and updates help files.
init: Initializes a DSPygen project.
lm: Generates language models.
module: Deals with generating or calling DSPy modules.
module: Deals with generating or calling DSPy dspy_modules.
sig: Generates dspy.Signatures.
tutor: Guides through project development with DSPyGen.
blog: Calls modules related to blogging.
book_appointment: Invokes modules for scheduling appointments.
blog: Calls dspy_modules related to blogging.
book_appointment: Invokes dspy_modules for scheduling appointments.
chat_bot: Initiates module calls for chatbots.
checker: Calls modules for checking or validating.
checker: Calls dspy_modules for checking or validating.
choose_function: Initiates module calls involving choice or selection functions.
dflss: Related to Six Sigma methodology, possibly for invoking process improvement modules.
gen_cli: Triggers modules for command-line interfaces.
gen_dspy: Calls modules specific to DSPy.
dflss: Related to Six Sigma methodology, possibly for invoking process improvement dspy_modules.
gen_cli: Triggers dspy_modules for command-line interfaces.
gen_dspy: Calls dspy_modules specific to DSPy.
gen_keyword_arguments: Initiates module calls with keyword arguments.
gen_signature: Invokes signature-related modules.
html: For modules related to HTML.
insight_tweet: Calls modules for generating insightful tweets.
gen_signature: Invokes signature-related dspy_modules.
html: For dspy_modules related to HTML.
insight_tweet: Calls dspy_modules for generating insightful tweets.
message: Initiates module calls for messaging.
module_docstring: Triggers module calls for documenting modules.
module_docstring: Triggers module calls for documenting dspy_modules.
product_bot: Invokes module calls for product-related bots.
prompt_function_call: Triggers modules for prompting function calls.
python_expert: For modules related to Python expertise.
prompt_function_call: Triggers dspy_modules for prompting function calls.
python_expert: For dspy_modules related to Python expertise.
python_source_code: Initiates module calls for generating Python source code.
source_code_pep8_docs: Triggers module calls for source code with PEP8 documentation.
subject_destination_audience_newsletter_article: Initiates module calls for newsletter articles.
text_summary_module: Calls modules for summarizing text.
to_elixir: Initiates module calls to convert modules to Elixir format.
text_summary_module: Calls dspy_modules for summarizing text.
to_elixir: Initiates module calls to convert dspy_modules to Elixir format.
Use this information to guide the usage of the DSPyGen CLI and its modules.
Use this information to guide the usage of the DSPyGen CLI and its dspy_modules.
"""

@app.command(name="tutor")
Expand Down
4 changes: 2 additions & 2 deletions src/dspygen/dsl/dsl_pydantic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ class PipelineDSLModel(BaseModel, YAMLMixin):
signatures: list[SignatureDSLModel] = Field(default=[],
description="list of signatures defined for use in the pipeline.")
lm_modules: list[LMModuleDSLModel] = Field(default=[],
description="list of language model modules defined for execution in the pipeline.")
description="list of language model dspy_modules defined for execution in the pipeline.")
rm_modules: list[RMModuleDSLModel] = Field(default=[],
description="list of retriever model modules defined for execution in the pipeline.")
description="list of retriever model dspy_modules defined for execution in the pipeline.")
steps: list[StepDSLModel] = Field(default=[],
description="Sequential steps to be executed in the pipeline.")
context: dict = Field(default=Munch(),
Expand Down
2 changes: 1 addition & 1 deletion src/dspygen/dsl/dsl_step_module.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Import necessary modules and classes
# Import necessary dspy_modules and classes
import dspy

from dspygen.dsl.dsl_pydantic_models import StepDSLModel, PipelineDSLModel, LanguageModelConfig
Expand Down
2 changes: 1 addition & 1 deletion src/dspygen/dsl/utils/dsl_lm_module_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _load_lm_module_class(dspy_module_class_name: str):
def _get_lm_module_instance(pipeline, rendered_args, step):
"""
Get the module instance for a given step from the top level definition or load the module.
Uses the DSLModule class from dspygen.modules.dsl_module to handle modules defined in the pipeline YAML.
Uses the DSLModule class from dspygen.dspy_modules.dsl_module to handle dspy_modules defined in the pipeline YAML.
"""
module_def = next((m for m in pipeline.lm_modules if m.name in step.module), None)

Expand Down
2 changes: 1 addition & 1 deletion src/dspygen/dsl/utils/dsl_rm_module_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def _load_rm_module_class(dspy_module_class_name: str):
def _get_rm_module_instance(pipeline, rendered_args, step):
"""
Get the module instance for a given step from the top level definition or load the module.
Uses the DSLModule class from dspygen.modules.dsl_module to handle modules defined in the pipeline YAML.
Uses the DSLModule class from dspygen.dspy_modules.dsl_module to handle dspy_modules defined in the pipeline YAML.
"""
# Get the file_path from the pipeline.context or rendered_args
# file_path = pipeline.context.get("file_path", rendered_args.get("file_path"))
Expand Down
6 changes: 3 additions & 3 deletions src/dspygen/dspygen_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#
# import streamlit as st
#
# from dspygen.modules.chat_bot_module import chat_bot_call
# from dspygen.modules.insight_tweet_module import insight_tweet_call
# from dspygen.modules.streamlit_bot_module import streamlit_bot_call
# from dspygen.dspy_modules.chat_bot_module import chat_bot_call
# from dspygen.dspy_modules.insight_tweet_module import insight_tweet_call
# from dspygen.dspy_modules.streamlit_bot_module import streamlit_bot_call
# from dspygen.utils.dspy_tools import init_dspy
# from dspygen.utils.file_tools import source_dir, pages_dir
#
Expand Down
4 changes: 2 additions & 2 deletions src/dspygen/experiments/auto_spider/spider_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,14 @@ def parse_linkedin_profile(linkedin_text: str) -> Optional[LinkedInProfile]:
AT&TAT&T
Feb 2016 - Nov 2017 · 1 yr 10 mosFeb 2016 to Nov 2017 · 1 yr 10 mos
Greater Los Angeles AreaGreater Los Angeles Area
In my role as Lead Software Engineer at AT&T, I specialized in AngularJS 2, focusing primarily on developing robust client-side applications. My responsibilities included the creation and integration of modules and components to build highly functional and performance-oriented user interfaces. I worked closely with artistic designers, translating their HTML templates into dynamic and responsive web designs, complete with animations and CSS stylings. Collaborating effectively with back-end development teams, I ensured seamless API integrations and data communication. My approach to development was marked by a commitment to creating intuitive, efficient, and visually appealing user experiences, backed by solid technical execution and team coordination.
In my role as Lead Software Engineer at AT&T, I specialized in AngularJS 2, focusing primarily on developing robust client-side applications. My responsibilities included the creation and integration of dspy_modules and components to build highly functional and performance-oriented user interfaces. I worked closely with artistic designers, translating their HTML templates into dynamic and responsive web designs, complete with animations and CSS stylings. Collaborating effectively with back-end development teams, I ensured seamless API integrations and data communication. My approach to development was marked by a commitment to creating intuitive, efficient, and visually appealing user experiences, backed by solid technical execution and team coordination.
Highlights:
- Spearheaded the development of client-side applications using AngularJS 2, enhancing user experience and application performance.
- Translated artistic design concepts into responsive web interfaces, incorporating animations and CSS stylings.
- Led module and component creation, integrating them to form cohesive and functional applications.
- Facilitated effective collaboration between front-end and back-end teams for seamless API integrations.
- Focused on delivering high-quality user interfaces with an emphasis on performance and user engagement.In my role as Lead Software Engineer at AT&T, I specialized in AngularJS 2, focusing primarily on developing robust client-side applications. My responsibilities included the creation and integration of modules and components to build highly functional and performance-oriented user interfaces. I worked closely with artistic designers, translating their HTML templates into dynamic and responsive web designs, complete with animations and CSS stylings. Collaborating effectively with back-end development teams, I ensured seamless API integrations and data communication. My approach to development was marked by a commitment to creating intuitive, efficient, and visually appealing user experiences, backed by solid technical execution and team coordination. Highlights: - Spearheaded the development of client-side applications using AngularJS 2, enhancing user experience and application performance. - Translated artistic design concepts into responsive web interfaces, incorporating animations and CSS stylings. - Led module and component creation, integrating them to form cohesive and functional applications. - Facilitated effective collaboration between front-end and back-end teams for seamless API integrations. - Focused on delivering high-quality user interfaces with an emphasis on performance and user engagement.
- Focused on delivering high-quality user interfaces with an emphasis on performance and user engagement.In my role as Lead Software Engineer at AT&T, I specialized in AngularJS 2, focusing primarily on developing robust client-side applications. My responsibilities included the creation and integration of dspy_modules and components to build highly functional and performance-oriented user interfaces. I worked closely with artistic designers, translating their HTML templates into dynamic and responsive web designs, complete with animations and CSS stylings. Collaborating effectively with back-end development teams, I ensured seamless API integrations and data communication. My approach to development was marked by a commitment to creating intuitive, efficient, and visually appealing user experiences, backed by solid technical execution and team coordination. Highlights: - Spearheaded the development of client-side applications using AngularJS 2, enhancing user experience and application performance. - Translated artistic design concepts into responsive web interfaces, incorporating animations and CSS stylings. - Led module and component creation, integrating them to form cohesive and functional applications. - Facilitated effective collaboration between front-end and back-end teams for seamless API integrations. - Focused on delivering high-quality user interfaces with an emphasis on performance and user engagement.
Angular2, Engineering Consulting and +1 skill
Playsino logo
Software ArchitectSoftware Architect
Expand Down
2 changes: 1 addition & 1 deletion src/dspygen/experiments/bkgn/get_soc_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def get_services():

def get_modules():
"""Retrieves code snippets from the '/Users/sac/dev/soc/src/soc/services' directory."""
return get_files_from_directory('/Users/sac/dev/soc/src/soc/modules')
return get_files_from_directory('/Users/sac/dev/soc/src/soc/dspy_modules')


def main():
Expand Down
2 changes: 1 addition & 1 deletion src/dspygen/experiments/done/gen_dsl_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def main2():

# module = GenModuleModel.to_inst(f"name: RawToStructure, raw_to_structure_signature, Predict {signature}")

module = GenLMModuleModel.from_yaml(str(dsl_dir("modules/raw_to_structure_module.yaml")))
module = GenLMModuleModel.from_yaml(str(dsl_dir("dspy_modules/raw_to_structure_module.yaml")))

# print(module)

Expand Down
2 changes: 1 addition & 1 deletion src/dspygen/mixin/fsm/order_processing_fsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class Choice(BaseModel):
#
# init_dspy()
# poss = fsm.possible_triggers()
# # from dspygen.modules.json_module import json_call
# # from dspygen.dspy_modules.json_module import json_call
# # response = json_call(schema=Choice.model_json_schema(),
# # text=f"{{\"possible_triggers\": {str(poss)}, \"prompt\": \"{message}\"}}")
# choice = dspy.Predict("possible_triggers, prompt -> choice")(possible_triggers=str(poss), prompt=message).choice
Expand Down
2 changes: 1 addition & 1 deletion src/dspygen/modules/book_appointment_module.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
The source code is used to import necessary libraries and modules, define a class and its methods, and create a command line interface using Typer. The BookAppointmentModule class is used to book appointments by predicting availability based on the requested date. The book_appointment_call function calls the BookAppointmentModule class and returns the result. The main function initializes the dspy library and calls the book_appointment_call function. The TODO section indicates that a streamlit component needs to be added, and the fastapi library is used to create an API endpoint for booking appointments. The book_appointment_route function uses the book_appointment_call function to generate code based on the data provided.
The source code is used to import necessary libraries and dspy_modules, define a class and its methods, and create a command line interface using Typer. The BookAppointmentModule class is used to book appointments by predicting availability based on the requested date. The book_appointment_call function calls the BookAppointmentModule class and returns the result. The main function initializes the dspy library and calls the book_appointment_call function. The TODO section indicates that a streamlit component needs to be added, and the fastapi library is used to create an API endpoint for booking appointments. The book_appointment_route function uses the book_appointment_call function to generate code based on the data provided.
"""
import dspy
from typer import Typer
Expand Down
4 changes: 2 additions & 2 deletions src/dspygen/modules/dflss_module.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
This code imports the necessary libraries and modules to run the DFLSSModule.
This code imports the necessary libraries and dspy_modules to run the DFLSSModule.
"""
import dspy
from dspygen.utils.dspy_tools import init_dspy
Expand Down Expand Up @@ -52,7 +52,7 @@ def dflss_call(scenario_description, document_type, to=None):
The current order processing system, implemented via a finite state machine, is functional but lacks the flexibility and modularity needed for easy scalability and maintenance. By integrating DSPy, the system can benefit from more structured data handling, automatic state management, and enhanced debugging capabilities through systematic logging and validation.
Project Scope:
Convert existing order processing methods and transitions into DSPy-compatible modules.
Convert existing order processing methods and transitions into DSPy-compatible dspy_modules.
Use DSPy's capabilities to handle different states of an order's lifecycle within a declarative pipeline environment.
Implement validation and action triggers as modular components.
Integrate state change triggers with conditions and actions based on DSPy’s event-driven architecture.
Expand Down
4 changes: 2 additions & 2 deletions src/dspygen/modules/dspygen_dsl_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ def process_yaml_pipeline(yaml_file):

dg_modules = []

for module_def in config['modules']:
for module_def in config['dspy_modules']:
module_class = globals()[f"{module_def['module']}DGModule"] # Get the module class by name
module_instance = module_class(**module_def.get('args', {}))

dg_modules.append(module_instance)

# Pipe the modules together because we need to do __or__ operations
# Pipe the dspy_modules together because we need to do __or__ operations
for i in range(len(dg_modules) - 1):
dg_modules[i] | dg_modules[i + 1]

Expand Down
2 changes: 1 addition & 1 deletion src/dspygen/modules/gen_keyword_arguments_module.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
The source code imports the necessary libraries and modules, including dspy and Typer. It also defines a class called GenKeywordArgumentsModule, which contains a forward function that takes in a prompt and function and returns a keyword_arguments_dict. The gen_keyword_arguments_call function uses the GenKeywordArgumentsModule to generate keyword arguments for a given prompt and function. The app.command() decorator defines a command for the Typer app, which calls the gen_keyword_arguments_call function. The main function initializes dspy and calls the gen_keyword_arguments_call function with empty prompt and function parameters. The TODO comments indicate future plans for the code, including adding a streamlit component and a FastAPI route.
The source code imports the necessary libraries and dspy_modules, including dspy and Typer. It also defines a class called GenKeywordArgumentsModule, which contains a forward function that takes in a prompt and function and returns a keyword_arguments_dict. The gen_keyword_arguments_call function uses the GenKeywordArgumentsModule to generate keyword arguments for a given prompt and function. The app.command() decorator defines a command for the Typer app, which calls the gen_keyword_arguments_call function. The main function initializes dspy and calls the gen_keyword_arguments_call function with empty prompt and function parameters. The TODO comments indicate future plans for the code, including adding a streamlit component and a FastAPI route.
"""
import ast
import inspect
Expand Down
Loading

0 comments on commit 2084b14

Please sign in to comment.