From b575935e6505dd3f75f742fce22d5f5ec0d3697b Mon Sep 17 00:00:00 2001 From: Nick Schenone Date: Tue, 1 Oct 2024 07:37:23 -0700 Subject: [PATCH] Added examples of controller-config.yaml/workflow-config.yaml and updated quick start (#30) * Added examples of controller-config.yaml/workflow-config.yaml and missing chromadb dependency * Updated quickstart --- controller/controller-config.yaml | 5 ++ controller/src/controller/config.py | 2 +- docker-compose.yml | 3 ++ examples/quick_start/notebook.ipynb | 64 ++++++++++++++--------- examples/quick_start/requirements.txt | 1 + examples/quick_start/workflow-config.yaml | 20 +++++++ 6 files changed, 68 insertions(+), 27 deletions(-) create mode 100644 controller/controller-config.yaml create mode 100644 examples/quick_start/requirements.txt create mode 100644 examples/quick_start/workflow-config.yaml diff --git a/controller/controller-config.yaml b/controller/controller-config.yaml new file mode 100644 index 0000000..6dcf173 --- /dev/null +++ b/controller/controller-config.yaml @@ -0,0 +1,5 @@ +verbose: true +log_level: DEBUG +db_type: sql +sql_connection_str: sqlite:////data/sql.db +application_url: http://localhost:8000 \ No newline at end of file diff --git a/controller/src/controller/config.py b/controller/src/controller/config.py index 3e28d6d..09f21ca 100644 --- a/controller/src/controller/config.py +++ b/controller/src/controller/config.py @@ -42,7 +42,7 @@ class CtrlConfig(BaseModel): def print(self): print(yaml.dump(self.dict())) - # @classmethod + @classmethod def load_from_yaml(cls, path: str): with open(path, "r") as f: data = yaml.safe_load(f) diff --git a/docker-compose.yml b/docker-compose.yml index 5084510..1649e34 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,9 @@ services: environment: - PYTHONPATH=/controller/src - CTRL_DATA_PATH=/data + - CTRL_CONFIG_PATH=/controller-config.yaml + volumes: + - ./controller/controller-config.yaml:/controller-config.yaml networks: - app-network diff --git a/examples/quick_start/notebook.ipynb b/examples/quick_start/notebook.ipynb index e4bec5f..9dc1ed2 100644 --- a/examples/quick_start/notebook.ipynb +++ b/examples/quick_start/notebook.ipynb @@ -29,7 +29,8 @@ "outputs": [], "source": [ "# Install MLRun from the feature branch\n", - "!pip install git+https://github.com/mlrun/genai-factory.git" + "!pip install git+https://github.com/mlrun/genai-factory.git\n", + "!pip install -r requirements.txt" ] }, { @@ -44,15 +45,15 @@ { "cell_type": "code", "execution_count": null, + "id": "7bb4a98dcb31cae1", + "metadata": { + "collapsed": false + }, "outputs": [], "source": [ "# Set the path for the environment file\n", "!export GENAI_FACTORY_ENV_PATH=$(pwd)/.env" - ], - "metadata": { - "collapsed": false - }, - "id": "7bb4a98dcb31cae1" + ] }, { "cell_type": "code", @@ -82,17 +83,17 @@ }, { "cell_type": "markdown", + "id": "61b0c86cc526df30", + "metadata": { + "collapsed": false + }, "source": [ "```bash\n", "make genai-factory\n", "```\n", "\n", "Run the above command in your terminal to deploy the GenAI Factory." - ], - "metadata": { - "collapsed": false - }, - "id": "61b0c86cc526df30" + ] }, { "cell_type": "markdown", @@ -113,6 +114,17 @@ "!genai-factory run workflow.py" ] }, + { + "cell_type": "markdown", + "id": "90a418bd", + "metadata": {}, + "source": [ + "Optionally make modifications to `workflow-config.yaml` and run like so\n", + "```shell\n", + "genai-factory run --config-path workflow-config.yaml workflow.py\n", + "```" + ] + }, { "cell_type": "markdown", "id": "2cf33b47-f313-46dd-a5d6-2c0359cc7296", @@ -125,22 +137,26 @@ }, { "cell_type": "markdown", + "id": "88d5b8ffda9bbe8b", + "metadata": { + "collapsed": false + }, "source": [ - "Run the following command in your terminal while inside the controller container:\n", + "Run the following command in your terminal while inside the **controller container**:\n", "\n", "```bash\n", "python -m controller ingest -l web https://docs.mlrun.org/en/stable/index.html\n", "```\n", "\n", "This command will ingest the MLRun documentation from the specified URL." - ], - "metadata": { - "collapsed": false - }, - "id": "88d5b8ffda9bbe8b" + ] }, { "cell_type": "markdown", + "id": "6ca5be89df585ac1", + "metadata": { + "collapsed": false + }, "source": [ "## Conclusion: Exploring the GenAI Factory UI\n", "\n", @@ -155,26 +171,22 @@ "Remember, the UI is your gateway to interacting with the GenAI Factory. It provides a visual and interactive way to manage your AI and machine learning tasks, monitor performance, and gain insights from your data.\n", "\n", "Feel free to refer back to the documentation if you need help understanding any specific features or functionalities you encounter in the UI." - ], - "metadata": { - "collapsed": false - }, - "id": "6ca5be89df585ac1" + ] }, { "cell_type": "markdown", - "source": [], + "id": "ce9f1015a62080a5", "metadata": { "collapsed": false }, - "id": "ce9f1015a62080a5" + "source": [] } ], "metadata": { "kernelspec": { - "name": "python3", + "display_name": "Python 3 (ipykernel)", "language": "python", - "display_name": "Python 3 (ipykernel)" + "name": "python3" }, "language_info": { "codemirror_mode": { diff --git a/examples/quick_start/requirements.txt b/examples/quick_start/requirements.txt new file mode 100644 index 0000000..a30104f --- /dev/null +++ b/examples/quick_start/requirements.txt @@ -0,0 +1 @@ +chromadb==0.5.3 \ No newline at end of file diff --git a/examples/quick_start/workflow-config.yaml b/examples/quick_start/workflow-config.yaml new file mode 100644 index 0000000..deed5ef --- /dev/null +++ b/examples/quick_start/workflow-config.yaml @@ -0,0 +1,20 @@ +chunk_overlap: 20 +chunk_size: 1024 +controller_url: http://localhost:8001 +controller_username: guest +default_llm: + class_name: langchain_openai.ChatOpenAI + model_name: gpt-3.5-turbo + temperature: 0 +default_vector_store: + class_name: chroma + collection_name: default + persist_directory: /tmp/chromadb/chroma +deployment_url: http://localhost:8000 +embeddings: + class_name: huggingface + model_name: all-MiniLM-L6-v2 +log_level: INFO +project_name: default +verbose: true +workflows_kwargs: {} \ No newline at end of file