Skip to content

Commit 205547a

Browse files
authored
[Docs Agent] Bug fix: Prevent the AQA model from failing when its response's (#524)
metadata returns entries containing an empty string. - Plus update the DraftReleaseNotes tasks with polished prompts. - Add a task file example to the main README.md file. - Minor update in the ExtractWorkflows task to remove extra spaces.
1 parent 2083ac7 commit 205547a

File tree

4 files changed

+30
-16
lines changed

4 files changed

+30
-16
lines changed

examples/gemini/python/docs-agent/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ stored in the [`tasks`][tasks-dir] directory of your Docs Agent project. The tas
3131
designed to be reusable and can be used to automate common workflows, such as generating
3232
release notes, updating documentation, or analyzing complex information.
3333

34+
A task file example:
35+
36+
```yaml
37+
tasks:
38+
- name: "ExtractWorkflows"
39+
model: "models/gemini-1.5-flash-latest"
40+
description: "An agent that extracts workflows from a source doc."
41+
steps:
42+
- prompt: "Summarize the contents of this document in a concise and informative manner. Focus on the key procedures, steps, or workflows described."
43+
flags:
44+
file: "<INPUT>"
45+
default_input: "./README.md"
46+
- prompt: "Identify and list all key workflows described in the document. Provide a brief description for each workflow, highlighting its purpose and key steps."
47+
- prompt: "Identify all command lines used in the workflows described in the document. Focus on command lines that are essential for executing the workflow steps."
48+
- prompt: "For each identified command line, provide a detailed description of its function and purpose. Include specific examples of its usage, showcasing how it is integrated within the workflows."
49+
```
50+
3451
To set up and run the `agent runtask` command, see [Set up Docs Agent CLI][cli-readme].
3552

3653
## Summary of features

examples/gemini/python/docs-agent/docs_agent/preprocess/splitters/markdown_splitter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def return_id(self):
119119

120120

121121
def DictionarytoSection(metadata: dict) -> Section:
122-
if "section_id" in metadata:
122+
if "section_id" in metadata and metadata["section_id"] != '':
123123
section_id = int(metadata["section_id"])
124124
else:
125125
section_id = ""
@@ -135,19 +135,19 @@ def DictionarytoSection(metadata: dict) -> Section:
135135
page_title = str(metadata["page_title"])
136136
else:
137137
page_title = ""
138-
if "section_level" in metadata:
138+
if "section_level" in metadata and metadata["section_level"] != '':
139139
section_level = int(metadata["section_level"])
140140
else:
141141
section_level = ""
142-
if "previous_id" in metadata:
142+
if "previous_id" in metadata and metadata["previous_id"] != '':
143143
previous_id = int(metadata["previous_id"])
144144
else:
145145
previous_id = ""
146146
if "parent_tree" in metadata:
147147
parent_tree = metadata["parent_tree"]
148148
else:
149149
parent_tree = []
150-
if "token_estimate" in metadata:
150+
if "token_estimate" in metadata and metadata["token_estimate"] != '':
151151
token_estimate = int(metadata["token_estimate"])
152152
else:
153153
token_estimate = ""

examples/gemini/python/docs-agent/tasks/extract-workflows-task.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ tasks:
88
file: "<INPUT>"
99
default_input: "./README.md"
1010
- prompt: "Identify and list all key workflows described in the document. Provide a brief description for each workflow, highlighting its purpose and key steps."
11-
- prompt: "Identify all command lines used in the workflows described in the document. Focus on command lines that are essential for executing the workflow steps."
12-
- prompt: "For each identified command line, provide a detailed description of its function and purpose. Include specific examples of its usage, showcasing how it is integrated within the workflows."
11+
- prompt: "Identify all command lines used in the workflows described in the document. Focus on command lines that are essential for executing the workflow steps."
12+
- prompt: "For each identified command line, provide a detailed description of its function and purpose. Include specific examples of its usage, showcasing how it is integrated within the workflows."
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
tasks:
22
- name: "DraftReleaseNotes"
3-
model: "models/gemini-1.5-flash-latest"
3+
model: "models/gemini-1.5-flash"
44
description: "An agent that generates a draft of Docs Agent release notes from git commit messages."
5+
preamble: "When generating release notes, limit the total number of key features and updates to 5 or fewer entries."
56
steps:
6-
- name: "Read git commit messages"
7-
description: "Load the git log commit messages from the local Fuchsia checkout since a target date."
7+
- prompt: "git --no-pager log --since=2024-06-15"
88
function: "posix"
9-
prompt: "git --no-pager log --since=2024-05-26"
10-
- name: "Create an initial release notes draft"
11-
function: "helpme"
12-
prompt: "Based on the commit messages above, create an initial release notes draft that introduces new features and brings attention to important messages."
13-
- name: "Revise the release notes draft"
14-
function: "helpme"
15-
prompt: "Revise the release notes draft above to be more concise and better structured, and if appropriate, include practical examples."
9+
description: "Load the git log commit messages from the local Docs Agent checkout since a target date."
10+
- prompt: "Please extract a list of key features and improvements from the provided git log commit messages, focusing on those that are most impactful and relevant for developers."
11+
- prompt: "Based on the extracted key features and improvements, write a concise and informative release notes draft. Use clear and concise language, focusing on the benefits and value provided to developers."
12+
- prompt: "Revise the release notes draft to enhance readability and structure. Format the release notes using bullet points for clarity and limit each entry to a maximum of two sentences."
1613

0 commit comments

Comments
 (0)