|
65 | 65 | "#@title Install GEPA\n", |
66 | 66 | "!git clone https://github.com/google/adk-python.git\n", |
67 | 67 | "!pip install gepa --quiet\n", |
| 68 | + "!pip install litellm --quiet\n", |
68 | 69 | "!pip install retry --quiet" |
69 | 70 | ] |
70 | 71 | }, |
|
112 | 113 | "import os\n", |
113 | 114 | "\n", |
114 | 115 | "from google.genai import types\n", |
115 | | - "import experiment as experiment_lib\n", |
| 116 | + "import utils\n", |
116 | 117 | "\n", |
117 | 118 | "\n", |
118 | 119 | "# @markdown ### ☁️ Configure Vertex AI Access\n", |
|
139 | 140 | "for logger in loggers:\n", |
140 | 141 | " logger.setLevel(logging.WARNING)\n", |
141 | 142 | "\n", |
142 | | - "types.logger.addFilter(experiment_lib.FilterInferenceWarnings())" |
| 143 | + "types.logger.addFilter(utils.FilterInferenceWarnings())" |
143 | 144 | ] |
144 | 145 | }, |
145 | 146 | { |
|
179 | 180 | "from google.adk.agents import base_agent\n", |
180 | 181 | "from google.adk.agents import llm_agent\n", |
181 | 182 | "\n", |
182 | | - "import tools\n", |
| 183 | + "from voter_agent import tools\n", |
183 | 184 | "\n", |
184 | 185 | "\n", |
185 | 186 | "# @markdown ### 🧠 Configure our ADK LLM Agent\n", |
|
368 | 369 | " return [line.strip() for line in open(filename) if line.strip()]\n", |
369 | 370 | "\n", |
370 | 371 | "\n", |
371 | | - "voter_data = _read_prompts('prompts.txt')\n", |
| 372 | + "_AGENT_DIR = 'adk-python/contributing/samples/gepa/voter_agent'\n", |
| 373 | + "\n", |
| 374 | + "\n", |
| 375 | + "voter_data = _read_prompts(f'{_AGENT_DIR}/prompts.txt')\n", |
372 | 376 | "voter_data" |
373 | 377 | ] |
374 | 378 | }, |
|
392 | 396 | "execution_count": null, |
393 | 397 | "metadata": { |
394 | 398 | "id": "9bHh93RuKVMu", |
395 | | - "outputId": "489761d4-da39-43ca-cd08-225c44bb3027" |
| 399 | + "outputId": "489761d4-da39-43ca-cd08-225c44bb3027", |
| 400 | + "cellView": "form" |
396 | 401 | }, |
397 | 402 | "outputs": [ |
398 | 403 | { |
|
714 | 719 | " tool_declarations=TOOLS_DESCRIPTION,\n", |
715 | 720 | " developer_instructions='',\n", |
716 | 721 | " rubric=FILTER_RUBRIC,\n", |
717 | | - "\n", |
| 722 | + " validation_template_path=f'{_AGENT_DIR}/rubric_validation_template.txt',\n", |
718 | 723 | ")\n", |
719 | 724 | "\n", |
720 | 725 | "print(rater(EXAMPLE_TRACE))" |
|
813 | 818 | "source": [ |
814 | 819 | "#@title Let's define an evaluation dataset from sample prompts\n", |
815 | 820 | "\n", |
816 | | - "eval_dataset = _read_prompts('eval_prompts.txt')\n", |
| 821 | + "eval_dataset = _read_prompts(f'{_AGENT_DIR}/eval_prompts.txt')\n", |
817 | 822 | "eval_dataset" |
818 | 823 | ] |
819 | 824 | }, |
|
2723 | 2728 | " task_lm=None, # this must be None when a custom adapter is used\n", |
2724 | 2729 | " adapter=adapter,\n", |
2725 | 2730 | " max_metric_calls=MAX_METRIC_CALLS,\n", |
2726 | | - " reflection_lm=experiment_lib.reflection_inference_fn(REFLECTION_MODEL_NAME),\n", |
| 2731 | + " reflection_lm=utils.reflection_inference_fn(REFLECTION_MODEL_NAME),\n", |
2727 | 2732 | " reflection_minibatch_size=MINI_BATCH_SIZE,\n", |
2728 | 2733 | ")\n", |
2729 | 2734 | "list(enumerate(gepa_results.val_aggregate_scores))" |
|
2955 | 2960 | ], |
2956 | 2961 | "metadata": { |
2957 | 2962 | "colab": { |
2958 | | - "collapsed_sections": [ |
2959 | | - "rIFFNqYoXp6v" |
2960 | | - ], |
2961 | 2963 | "last_runtime": { |
2962 | 2964 | "build_target": "//learning/language/tunelab/tunekit/colab:colab_notebook", |
2963 | 2965 | "kind": "private" |
|
0 commit comments