Skip to content

Commit b7d8a07

Browse files
docs-agent fixes (#612)
1 parent 378fdab commit b7d8a07

File tree

14 files changed

+28
-28
lines changed

14 files changed

+28
-28
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ in the information that you provide and control.
2424
The key features of the Docs Agent chat app are:
2525

2626
- Add contextual information to user questions to augment prompts for AI language models.
27-
- Process documents into embeddings and store them in a vector database for semnatic retrieval.
27+
- Process documents into embeddings and store them in a vector database for semantic retrieval.
2828

2929
![Docs Agent flow](./images/docs-agent-architecture-02.png)
3030

@@ -50,7 +50,7 @@ shown in Figure 3 to augment the user question with a preset **condition** and a
5050
[`config.yaml`][config-yaml] file.) Then the Docs Agent server sends this prompt to a
5151
language model using the Gemini API and receives a response generated by the model.
5252

53-
![Docs Agent prompt strcture](./images/docs-agent-prompt-structure-01.png)
53+
![Docs Agent prompt structure](./images/docs-agent-prompt-structure-01.png)
5454

5555
**Figure 3**. Prompt structure for augmenting a user question with related context
5656
(Context source: [eventhorizontelescope.org][context-source-01])
@@ -244,7 +244,7 @@ db_type: "google_semantic_retriever"
244244
The setup above uses both the Semantic Retrieval API and the AQA model.
245245

246246
**Note**: At the moment, when `db_type` is set to `google_semantic_retriever`, running the
247-
`populate_vector_database.py` script will also create and popluate a local vector database using
247+
`populate_vector_database.py` script will also create and populate a local vector database using
248248
Chroma as well as creating and populating an online corpus using the Semantic Retrieval API.
249249

250250
However, if you want to use only the AQA model without using an online corpus, update the

examples/gemini/python/docs-agent/docs/create-a-new-task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ A step that runs the `tellme` command:
308308

309309
Using the `tellme` command requires **a vector database setup**.
310310

311-
<!-- Referene links -->
311+
<!-- Reference links -->
312312

313313
[model-code]: https://ai.google.dev/gemini-api/docs/models/gemini
314314
[tasks-dir]: ../tasks

examples/gemini/python/docs-agent/docs_agent/interfaces/chatbot/chatui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def construct_blueprint(
5555
if product_config.secondary_db_type == "chroma":
5656
docs_agent = DocsAgent(config=product_config, init_chroma=True)
5757
else:
58-
# A local Chroma DB is not needed for the Semantic Retreiver only mode.
58+
# A local Chroma DB is not needed for the Semantic Retriever only mode.
5959
docs_agent = DocsAgent(config=product_config, init_chroma=False)
6060
elif product_config.db_type == "none":
6161
docs_agent = DocsAgent(

examples/gemini/python/docs-agent/docs_agent/interfaces/cli/cli_admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def delete_corpus(
208208
click.echo("Deleting " + name)
209209
if click.confirm("Do you want to continue?", abort=True):
210210
semantic.delete_a_corpus(corpus_name=name, force=True)
211-
click.echo("Successfuly deleted " + name)
211+
click.echo("Successfully deleted " + name)
212212
corpora_response = semantic.list_existing_corpora()
213213
click.echo(f"Corpora list:\n{corpora_response}")
214214

examples/gemini/python/docs-agent/docs_agent/interfaces/cli/cli_helpme.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def helpme(
284284

285285
# Select the mode.
286286
if helpme_mode == "PREVIOUS_EXCHANGES":
287-
# Continue mode, which uses the previous exchangs as the main context.
287+
# Continue mode, which uses the previous exchanges as the main context.
288288
this_output = console.ask_model_with_file(
289289
question.strip(),
290290
product_config,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ def construct_chunks(library_name: str, protocol_name: str, lines):
5959
contents = []
6060
buffer_size = get_byte_size(lines)
6161
if int(buffer_size) > 5000:
62-
# If the protocol is larget than 5KB, divide it into two.
62+
# If the protocol is larger than 5KB, divide it into two.
6363
logging.info(
6464
"Found a text chunk ("
6565
+ str(protocol_name)
66-
+ ") is greater than 6KB (size: "
66+
+ ") is greater than 5KB (size: "
6767
+ str(buffer_size)
6868
+ ")."
6969
)
@@ -116,11 +116,11 @@ def split_file_to_protocols(this_file):
116116
# print("MATCHED [End bracket]")
117117
line_buffer.append(line)
118118
if library_name != "" and protocol_name != "":
119-
# Prepre a captured FIDL protocl into small text chunks.
119+
# Prepare a captured FIDL protocol into small text chunks.
120120
contents = construct_chunks(library_name, protocol_name, line_buffer)
121121
for content in contents:
122122
protocols.append(content)
123-
# Clear the line butter and protocol name when an end bracket is found.
123+
# Clear the line buffer and protocol name when an end bracket is found.
124124
line_buffer.clear()
125125
protocol_name = ""
126126
else:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ def process_document_into_sections(markdown_text):
629629
return sections
630630

631631

632-
# Process an array of Markdwon text into an array of string buffers
632+
# Process an array of Markdown text into an array of string buffers
633633
# whose size is smaller than 5KB.
634634
def construct_chunks(lines):
635635
contents = []

examples/gemini/python/docs-agent/docs_agent/storage/google_semantic_retriever.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616

17-
"""Semantic Retrievel module for using the Semantic Retrieval API with AQA"""
17+
"""Semantic Retrieval module for using the Semantic Retrieval API with AQA"""
1818

1919
import google.ai.generativelanguage as glm
2020
from absl import logging
@@ -133,7 +133,7 @@ def create_a_doc(
133133
# Set the `document_resource_name` for subsequent sections.
134134
document_resource_name = create_document_response.name
135135
except:
136-
logging.error(f"Cannot create a new doucment: {page_title}")
136+
logging.error(f"Cannot create a new document: {page_title}")
137137
exit(1)
138138
return document_resource_name
139139

@@ -144,7 +144,7 @@ def retrieve_a_doc(self, document_resource_name: str):
144144
# Make the request
145145
response = self.retriever_service_client.get_document(get_document_request)
146146
except:
147-
logging.error(f"Cannot retrieve a doucment: {document_resource_name}")
147+
logging.error(f"Cannot retrieve a document: {document_resource_name}")
148148
return response
149149

150150
def create_a_chunk(
@@ -241,10 +241,10 @@ def create_a_doc_chunk(
241241
)
242242
return chunk
243243
except:
244-
logging.error("Error in creaing a doc chunk: " + page_title)
244+
logging.error("Error in creating a doc chunk: " + page_title)
245245
return None
246246
except:
247-
logging.error("Error in creaing a doc chunk: " + page_title)
247+
logging.error("Error in creating a doc chunk: " + page_title)
248248
return None
249249

250250
def get_all_docs(self, corpus_name: str, print_output: bool = False):

examples/gemini/python/docs-agent/docs_agent/utilities/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ def __init__(self, yaml_path_input: str | None = None):
581581
sys.exit(1)
582582

583583
def __str__(self):
584-
# Returns the absoulte path to the config file or provides an error message
584+
# Returns the absolute path to the config file or provides an error message
585585
return getattr(self, "yaml_path", "Config path not determined")
586586

587587
def returnProducts(self, product: typing.Optional[str] = None) -> ConfigFile:

examples/gemini/python/docs-agent/scripts/extract_replace_image_alt_text.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
This script extracts image paths from markdown, html, or directory of files.
1818
1919
Usage:
20-
python extract_image_files.py <input_file>
20+
python extract_replace_image_alt_text.py <input_file>
2121
2222
Example:
23-
python extract_image_files.py my_document.md
24-
python extract_image_files.py my_document.html
25-
python extract_image_files.py my_documents_folder
23+
python extract_replace_image_alt_text.py my_document.md
24+
python extract_replace_image_alt_text.py my_document.html
25+
python extract_replace_image_alt_text.py my_documents_folder
2626
"""
2727

2828
import os

0 commit comments

Comments
 (0)