Skip to content

Commit 2b9dd61

Browse files
committed
[Docs Agent] Release of Docs Agent v 0.3.6.
What's changed: - Runtask enhancement: The `runtask` command allows specifying a custom input string using the `--custom_input` flag. - ExtractWorkflows task: This new task extracts workflows and commandlines from a source document. - HelpPolishPrompts task: This task helps users polish prompts in a task file. - IndexPageGenerator task: This task generates an index page describing files in a given directory. - Chat app bug fix: Fixed an issue where + characters were removed from the page title.
1 parent 1c9ebfa commit 2b9dd61

File tree

18 files changed

+398
-141
lines changed

18 files changed

+398
-141
lines changed

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

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ Docs Agent provides a set of easy-to-use self-service tools designed to give you
77
your team access to Google's [Gemini API][genai-doc-site] for learning, experimentation,
88
and project deployment.
99

10-
## Overview
10+
## Docs Agent web app
1111

12-
Docs Agent apps use a technique known as Retrieval Augmented Generation (RAG), which
12+
Docs Agent uses a technique known as **Retrieval Augmented Generation (RAG)**, which
1313
allows you to bring your own documents as knowledge sources to AI language models.
1414
This approach helps the AI language models to generate relevant and accurate responses
1515
that are grounded in the information that you provide and control.
@@ -18,13 +18,24 @@ that are grounded in the information that you provide and control.
1818

1919
**Figure 1**. Docs Agent uses a vector database to retrieve context for augmenting prompts.
2020

21-
Docs Agent apps are designed to be easily set up and configured in a Linux environment.
22-
If you want to set up and launch the Docs Agent chat app on your host machine, check out
23-
the [Set up Docs Agent][set-up-docs-agent] section below.
21+
The Docs Agent chatbot web app is designed to be easily set up and configured in a Linux
22+
environment. If you want to set up and launch the Docs Agent chat app on your host machine,
23+
check out the [Set up Docs Agent][set-up-docs-agent] section below.
2424

25-
### Summary of features
25+
## Docs Agent tasks
2626

27-
The following list summarizes the tasks and features supported by Docs Agent:
27+
Docs Agent's `agent runtask` command allows you to run pre-defined chains of prompts,
28+
which are referred to as **tasks**. These tasks simplify complex interactions by defining
29+
a series of steps that the Docs Agent will execute. The tasks are defined in `.yaml` files
30+
stored in the [`tasks`][tasks-dir] directory of your Docs Agent project. The tasks are
31+
designed to be reusable and can be used to automate common workflows, such as generating
32+
release notes, updating documentation, or analyzing complex information.
33+
34+
To set up and run the `agent runtask` command, see [Set up Docs Agent CLI][cli-readme].
35+
36+
## Summary of features
37+
38+
The list below summarizes the tasks and features supported by Docs Agent:
2839

2940
- **Process Markdown**: Split Markdown files into small plain text chunks. (See
3041
[Docs Agent chunking process][chunking-process].)
@@ -60,9 +71,9 @@ The following list summarizes the tasks and features supported by Docs Agent:
6071
[Set up the Docs Agent CLI][cli-readme] to make requests to the Gemini models
6172
from anywhere in a terminal.
6273
- **Support the Gemini 1.5 models**: Docs Agent works with the Gemini 1.5 models,
63-
`gemini-1.5-pro-latest` and `text-embedding-004`. The new ["1.5"][new-15-mode] web app
64-
mode uses all three Gemini models to their strength: AQA (`aqa`), Gemini 1.0 Pro
65-
(`gemini-pro`), and Gemini 1.5 Pro (`gemini-1.5-pro-latest`).
74+
`gemini-1.5-pro`, `gemini-1.5-flash`, and `text-embedding-004`. The new
75+
[`full`][new-15-mode] web app mode uses all three Gemini models to their strength:
76+
AQA (`aqa`), Gemini 1.0 Pro (`gemini-pro`), and Gemini 1.5 Pro (`gemini-1.5-pro`).
6677
- **Complete a task using the Docs Agent CLI**: The `agent runtask` command allows you
6778
to run pre-defined chains of prompts, which are referred to as tasks. These tasks
6879
simplify complex interactions by defining a series of steps that the Docs Agent will

examples/gemini/python/docs-agent/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
configs:
1818
- product_name: "Fuchsia"
1919
models:
20-
- language_model: "models/aqa"
20+
- language_model: "models/gemini-1.5-flash-latest"
2121
embedding_model: "models/embedding-001"
2222
api_endpoint: "generativelanguage.googleapis.com"
2323
embedding_api_call_limit: 1400
2424
embedding_api_call_period: 60
2525
docs_agent_config: "normal"
2626
markdown_splitter: "token_splitter"
2727
log_level: "NORMAL"
28-
db_type: "google_semantic_retriever"
28+
db_type: "chroma"
2929
db_configs:
3030
- db_type: "chroma"
3131
vector_db_dir: "vector_stores/chroma"

examples/gemini/python/docs-agent/docs/cli-reference.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,29 @@ For example:
273273
agent runtask --task DraftReleaseNotes
274274
```
275275

276+
### View the list of available Docs Agent tasks
277+
276278
To see the list of all tasks available in your project, run
277-
`agent runtask` without any arguments.
279+
`agent runtask` without any arguments:
280+
281+
```sh
282+
agent runtask
283+
```
284+
285+
### Ask the model to run a task using custom input
286+
287+
If a task script has a `<INPUT>` placeholder, you can provide
288+
a custom input string to the task:
289+
290+
```sh
291+
agent runtask --task <TASK> --custom_input <INPUT_STRING>
292+
```
293+
294+
For example:
295+
296+
```sh
297+
agent runtask --task IndexPageGenerator --custom_input ~/my_example/docs/development/
298+
```
278299

279300
## Managing online corpora
280301

examples/gemini/python/docs-agent/docs_agent/agents/docs_agent.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,11 @@ def add_custom_instruction_to_context(self, condition, context):
359359

360360
# Return true if the aqa model used in this Docs Agent setup
361361
def check_if_aqa_is_used(self):
362-
if self.config.models.language_model == "models/aqa":
362+
if (
363+
self.config.models.language_model == "models/aqa"
364+
or self.config.app_mode == "full"
365+
or self.config.app_mode == "widget-pro"
366+
):
363367
return True
364368
else:
365369
return False
@@ -525,16 +529,21 @@ def ask_content_model_with_context_prompt(
525529
try:
526530
response = ""
527531
if model == "gemini-pro":
528-
response = self.gemini_pro.generate_content(contents=new_prompt)
532+
response = self.gemini_pro.generate_content(
533+
contents=new_prompt, log_level=self.config.log_level
534+
)
529535
elif model == "gemini-1.5":
530-
response = self.gemini_15.generate_content(contents=new_prompt)
536+
response = self.gemini_15.generate_content(
537+
contents=new_prompt, log_level=self.config.log_level
538+
)
531539
else:
532-
response = self.gemini.generate_content(contents=new_prompt)
533-
except:
540+
response = self.gemini.generate_content(
541+
contents=new_prompt, log_level=self.config.log_level
542+
)
543+
except Exception as e:
544+
print("Error in generate_content()")
545+
print(e)
534546
return self.config.conditions.model_error_message, new_prompt
535-
# for chunk in response:
536-
# if str(chunk.candidates[0].content) == "":
537-
# return self.config.conditions.model_error_message, new_prompt
538547
return response, new_prompt
539548

540549
# Use this method for talking to a Gemini content model
@@ -549,9 +558,6 @@ def ask_content_model_to_use_file(self, prompt: str, file: str):
549558
response = self.gemini.generate_content(contents=new_prompt)
550559
except google.api_core.exceptions.InvalidArgument:
551560
return self.config.conditions.model_error_message
552-
# for chunk in response:
553-
# if str(chunk.candidates[0].content) == "":
554-
# return self.config.conditions.model_error_message
555561
return response
556562

557563
# Use this method for asking a Gemini content model for fact-checking.

0 commit comments

Comments
 (0)