Skip to content

Commit

Permalink
[Docs Agent] Bug fix: Prevent the AQA model from failing when its res…
Browse files Browse the repository at this point in the history
…ponse'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.
  • Loading branch information
kyolee415 authored Sep 23, 2024
1 parent 2083ac7 commit 205547a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 16 deletions.
17 changes: 17 additions & 0 deletions examples/gemini/python/docs-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,23 @@ stored in the [`tasks`][tasks-dir] directory of your Docs Agent project. The tas
designed to be reusable and can be used to automate common workflows, such as generating
release notes, updating documentation, or analyzing complex information.

A task file example:

```yaml
tasks:
- name: "ExtractWorkflows"
model: "models/gemini-1.5-flash-latest"
description: "An agent that extracts workflows from a source doc."
steps:
- prompt: "Summarize the contents of this document in a concise and informative manner. Focus on the key procedures, steps, or workflows described."
flags:
file: "<INPUT>"
default_input: "./README.md"
- prompt: "Identify and list all key workflows described in the document. Provide a brief description for each workflow, highlighting its purpose and key steps."
- 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."
- 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."
```
To set up and run the `agent runtask` command, see [Set up Docs Agent CLI][cli-readme].

## Summary of features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def return_id(self):


def DictionarytoSection(metadata: dict) -> Section:
if "section_id" in metadata:
if "section_id" in metadata and metadata["section_id"] != '':
section_id = int(metadata["section_id"])
else:
section_id = ""
Expand All @@ -135,19 +135,19 @@ def DictionarytoSection(metadata: dict) -> Section:
page_title = str(metadata["page_title"])
else:
page_title = ""
if "section_level" in metadata:
if "section_level" in metadata and metadata["section_level"] != '':
section_level = int(metadata["section_level"])
else:
section_level = ""
if "previous_id" in metadata:
if "previous_id" in metadata and metadata["previous_id"] != '':
previous_id = int(metadata["previous_id"])
else:
previous_id = ""
if "parent_tree" in metadata:
parent_tree = metadata["parent_tree"]
else:
parent_tree = []
if "token_estimate" in metadata:
if "token_estimate" in metadata and metadata["token_estimate"] != '':
token_estimate = int(metadata["token_estimate"])
else:
token_estimate = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ tasks:
file: "<INPUT>"
default_input: "./README.md"
- prompt: "Identify and list all key workflows described in the document. Provide a brief description for each workflow, highlighting its purpose and key steps."
- 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."
- 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."
- 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."
- 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."
17 changes: 7 additions & 10 deletions examples/gemini/python/docs-agent/tasks/release-notes-task.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
tasks:
- name: "DraftReleaseNotes"
model: "models/gemini-1.5-flash-latest"
model: "models/gemini-1.5-flash"
description: "An agent that generates a draft of Docs Agent release notes from git commit messages."
preamble: "When generating release notes, limit the total number of key features and updates to 5 or fewer entries."
steps:
- name: "Read git commit messages"
description: "Load the git log commit messages from the local Fuchsia checkout since a target date."
- prompt: "git --no-pager log --since=2024-06-15"
function: "posix"
prompt: "git --no-pager log --since=2024-05-26"
- name: "Create an initial release notes draft"
function: "helpme"
prompt: "Based on the commit messages above, create an initial release notes draft that introduces new features and brings attention to important messages."
- name: "Revise the release notes draft"
function: "helpme"
prompt: "Revise the release notes draft above to be more concise and better structured, and if appropriate, include practical examples."
description: "Load the git log commit messages from the local Docs Agent checkout since a target date."
- 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."
- 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."
- 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."

0 comments on commit 205547a

Please sign in to comment.