{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "fc00c2fa", "metadata": {}, "outputs": [], "source": [ "import dspy\n", "import os" ] }, { "cell_type": "code", "execution_count": null, "id": "3a1670ba", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null "id": "194bf39b", "metadata": {}, "outputs": [], "source": [ "gpt_5_mini = dspy.LM(\n", " model=\"openai/gpt-5-mini\",\n", " api_key=os.getenv(\"OPENAI_API_KEY\"),\n", " temperature=float(os.getenv(\"TEMPERATURE\", 1.0)),\n", " max_tokens= None,\n", " # max_completion_tokens=3000,\n", " cache=False\n", ")" ] }, { "cell_type": "code", "execution_count": 11, "id": "011b0ca4", "metadata": {}, "outputs": [], "source": [ "dspy.configure(lm= gpt_5_mini)\n", "\n", "allocator = dspy.Predict(\"goal,planner_desc,dataset->exact_word_complexity:Literal['unrelated','basic', 'intermediate', 'advanced'],reasoning\")\n", "\n", "\n", "session = allocator(goal=\"build me a regression model and then visualize the residuals\", planner_desc='{data_viz_agent:\"I love visualizaing\"}', dataset='housing dataset, can only answer housing')\n", "\n" ] }, { "cell_type": "code", "execution_count": 12, "id": "0217d501", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Prediction(\n", " exact_word_complexity='intermediate',\n", " reasoning='Building a regression model and visualizing residuals requires moderate statistical and coding knowledge: selecting and preprocessing features from the housing dataset, splitting data, fitting a model (e.g., linear or regularized regression), computing evaluation metrics (MSE, R²), and creating diagnostic plots (residuals vs. fitted, histogram or KDE of residuals, Q–Q plot, and scale-location). It’s more than a basic copy-paste task because it involves assumption checks and exploratory/feature work, but it doesn’t require the advanced theory or highly specialized modeling techniques that would push it into “advanced.” The work is therefore best categorized as intermediate.'\n", ")" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "session" ] }, { "cell_type": "code", "execution_count": null, "id": "2bf84f7e", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "base", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.7" } }, "nbformat": 4, "nbformat_minor": 5 }