Skip to content

Commit

Permalink
Fix typos (#437)
Browse files Browse the repository at this point in the history
* update_time defined twice hence removing once.

* removed redundant parentheses from some test cases

* removed multi-step list initialization

* Removed unused import

* Revert "Removed unused import"

This reverts commit d1e6012.

* fix black issue

* fix typos
  • Loading branch information
PandasPirate authored Jul 8, 2024
1 parent fb033db commit 13d2f52
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions google/generativeai/answer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def to_answer_style(x: AnswerStyleOptions) -> AnswerStyle:
def _make_grounding_passages(source: GroundingPassagesOptions) -> protos.GroundingPassages:
"""
Converts the `source` into a `protos.GroundingPassage`. A `GroundingPassages` contains a list of
`protos.GroundingPassage` objects, which each contain a `protos.Contant` and a string `id`.
`protos.GroundingPassage` objects, which each contain a `protos.Content` and a string `id`.
Args:
source: `Content` or a `GroundingPassagesOptions` that will be converted to protos.GroundingPassages.
Expand Down Expand Up @@ -191,7 +191,7 @@ def _make_generate_answer_request(
single question to answer. For multi-turn queries, this is a repeated field that contains
conversation history and the last `Content` in the list containing the question.
inline_passages: Grounding passages (a list of `Content`-like objects or `(id, content)` pairs,
or a `protos.GroundingPassages`) to send inline with the request. Exclusive with `semantic_retreiver`,
or a `protos.GroundingPassages`) to send inline with the request. Exclusive with `semantic_retriever`,
one must be set, but not both.
semantic_retriever: A Corpus, Document, or `protos.SemanticRetrieverConfig` to use for grounding. Exclusive with
`inline_passages`, one must be set, but not both.
Expand Down Expand Up @@ -267,7 +267,7 @@ def generate_answer(
>>> my_corpus = retriever.get_corpus('my_corpus')
>>> genai.generate_answer(
... content=question,
... semantic_retreiver=my_corpus
... semantic_retriever=my_corpus
... )
Expand All @@ -276,7 +276,7 @@ def generate_answer(
contents: The question to be answered by the model, grounded in the
provided source.
inline_passages: Grounding passages (a list of `Content`-like objects or (id, content) pairs,
or a `protos.GroundingPassages`) to send inline with the request. Exclusive with `semantic_retreiver`,
or a `protos.GroundingPassages`) to send inline with the request. Exclusive with `semantic_retriever`,
one must be set, but not both.
semantic_retriever: A Corpus, Document, or `protos.SemanticRetrieverConfig` to use for grounding. Exclusive with
`inline_passages`, one must be set, but not both.
Expand Down Expand Up @@ -330,7 +330,7 @@ async def generate_answer_async(
contents: The question to be answered by the model, grounded in the
provided source.
inline_passages: Grounding passages (a list of `Content`-like objects or (id, content) pairs,
or a `protos.GroundingPassages`) to send inline with the request. Exclusive with `semantic_retreiver`,
or a `protos.GroundingPassages`) to send inline with the request. Exclusive with `semantic_retriever`,
one must be set, but not both.
semantic_retriever: A Corpus, Document, or `protos.SemanticRetrieverConfig` to use for grounding. Exclusive with
`inline_passages`, one must be set, but not both.
Expand Down
2 changes: 1 addition & 1 deletion google/generativeai/generative_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def _prepare_request(
"""Creates a `protos.GenerateContentRequest` from raw inputs."""
if hasattr(self, "_cached_content") and any([self._system_instruction, tools, tool_config]):
raise ValueError(
"`tools`, `tool_config`, `system_instruction` cannot be set on a model instantinated with `cached_content` as its context."
"`tools`, `tool_config`, `system_instruction` cannot be set on a model instantiated with `cached_content` as its context."
)

tools_lib = self._get_tools_lib(tools)
Expand Down
2 changes: 1 addition & 1 deletion google/generativeai/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def update_tuned_model(
client: glm.ModelServiceClient | None = None,
request_options: helper_types.RequestOptionsType | None = None,
) -> model_types.TunedModel:
"""Calls the API to puch updates to a specified tuned model where only certain attributes are updatable."""
"""Calls the API to push updates to a specified tuned model where only certain attributes are updatable."""

if request_options is None:
request_options = {}
Expand Down
2 changes: 1 addition & 1 deletion google/generativeai/notebook/flag_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def _has_non_default_value(
Args:
namespace: The Namespace that is populated by ArgumentParser.
dest: The attribute in the Namespacde to be populated.
dest: The attribute in the Namespace to be populated.
has_default: "None" is a valid default value so we use an additional
`has_default` boolean to indicate that `default_value` is present.
default_value: The default value to use when `has_default` is True.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
def _convert_view_to_output_row(
row: llmfn_output_row.LLMFnOutputRowView,
) -> llmfn_output_row.LLMFnOutputRow:
"""Convenience method to conert a LLMFnOutputRowView to LLMFnOutputRow.
"""Convenience method to convert a LLMFnOutputRowView to LLMFnOutputRow.
If `row` is already a LLMFnOutputRow, return as-is for efficiency.
This could potentially break encapsulation as it could let code to modify
Expand Down
2 changes: 1 addition & 1 deletion google/generativeai/types/retriever_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ def batch_update_chunks(
Update multiple chunks within the same document.
Args:
chunks: Data structure specifying which `Chunk`s to update and what the required updats are.
chunks: Data structure specifying which `Chunk`s to update and what the required updates are.
request_options: Options for the request.
Return:
Expand Down

0 comments on commit 13d2f52

Please sign in to comment.