Skip to content

Conversation

@keyurva
Copy link
Contributor

@keyurva keyurva commented Jan 26, 2026

  • Added support for resolving NL queries to indicators (variables and topics)
  • Updated resolve endpoint to support resolver and target arguments
  • Added fetch_indicators convenience method
  • Added match scores and entity types in response candidates
  • Added unit tests and also did manual verification against custom dc on dc-dev with this script

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @keyurva, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the datacommons_client by introducing the capability to resolve natural language queries into specific indicators like statistical variables and topics. It achieves this by extending the existing resolve endpoint with new optional parameters and providing a dedicated, user-friendly method for indicator fetching. Furthermore, the changes enrich the resolution response with additional metadata, offering more detailed insights into the resolved candidates.

Highlights

  • Indicator Resolution Support: Added functionality to resolve natural language queries into indicators, such as statistical variables and topics.
  • Enhanced Resolve Endpoint: The resolve endpoint now supports new resolver and target arguments, allowing for more specific resolution queries.
  • New Convenience Method: A new fetch_indicators method has been introduced for easily fetching resolved indicators.
  • Enriched Response Data: Resolution response candidates now include additional match scores and entity types in their metadata for better context.
  • Comprehensive Testing: New unit tests have been added for the indicator resolution functionality, alongside regression tests to ensure existing features remain stable.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively adds support for resolving natural language queries to indicators by updating the resolve endpoint, adding a new fetch_indicators convenience method, and updating the relevant data models and tests. The changes are logical and well-tested. My review includes one suggestion to add validation logic to the ResolveRequestPayload model to ensure the new arguments (resolver and target) are used correctly, which will improve the robustness of the client.

Comment on lines +136 to +139
expression: str | list[str] | None = Field(default=None,
serialization_alias="property")
resolver: str | None = Field(default=None, serialization_alias="resolver")
target: str | None = Field(default=None, serialization_alias="target")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

To ensure that ResolveRequestPayload is always used correctly, it's a good practice to add validation directly to the Pydantic model. This will prevent invalid combinations of expression, resolver, and target regardless of how the payload is created.

You can add a model_validator to enforce that:

  1. expression and resolver are mutually exclusive.
  2. target is only provided when resolver is also present.

Here is a suggested implementation to add to the ResolveRequestPayload class:

  @model_validator(mode="after")
  def _validate_resolver_args(self):
    if self.expression is not None and self.resolver is not None:
      raise ValueError(
          "`expression` and `resolver` are mutually exclusive and cannot be used together."
      )
    if self.target is not None and self.resolver is None:
      raise ValueError("`target` can only be used with `resolver`.")
    return self

@keyurva keyurva requested a review from clincoln8 January 26, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant