Skip to content

Add tooltip to fields#233

Merged
harishmohanraj merged 4 commits into
mainfrom
62-add-tooltip-for-all-the-fields-in-the-form
Sep 17, 2024
Merged

Add tooltip to fields#233
harishmohanraj merged 4 commits into
mainfrom
62-add-tooltip-for-all-the-fields-in-the-form

Conversation

@harishmohanraj

Copy link
Copy Markdown
Contributor

Description

Please include a summary of the change and specify which issue is being addressed. Additionally, provide relevant motivation and context.

Fixes # (issue number)

Type of change

Please delete options that are not relevant.

  • Documentation (typos, code examples, or any documentation updates)
  • Bug fix (a non-breaking change that resolves an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a fix or feature that would disrupt existing functionality)
  • This change requires a documentation update

Checklist

  • My code adheres to the style guidelines of this project (scripts/lint.sh shows no errors)
  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation
  • My changes do not generate any new warnings
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature
  • Both new and existing unit tests pass successfully on my local environment by running scripts/test-cov.sh
  • I have ensured that static analysis tests are passing by running scripts/static-anaylysis.sh
  • I have included code examples to illustrate the modifications

@harishmohanraj harishmohanraj linked an issue Sep 16, 2024 that may be closed by this pull request
2 tasks
@codecov

codecov Bot commented Sep 16, 2024

Copy link
Copy Markdown

str,
Field(
description="The system message of the agent. This message is used to inform the agent about his role in the conversation"
description="The system message of the agent. This message is used to inform the agent about his role in the conversation",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not very elegant. Why don't you create a subclass of Field that has an additional tooltip parameter in its constructor:

import pydantic

class Field(pydantic.Field):
  __init__(self, default: Any, *, description: str, tooltip: str, **kwargs: Any):
    super():__init__(
      default,
      description=description, 
      json_schema_extra={
        "metadata": {
          "tooltip_message": tooltip
                }
            }
    )

Then you can write something like this:

    system_message: Annotated[
        str,
        Field(
          description="whatever",
          tooltip="whocares",
       )
    )

Comment thread fastagency/studio/models/base.py Outdated
@harishmohanraj harishmohanraj added this pull request to the merge queue Sep 17, 2024
Merged via the queue into main with commit 15192c5 Sep 17, 2024
@harishmohanraj harishmohanraj deleted the 62-add-tooltip-for-all-the-fields-in-the-form branch September 17, 2024 13:46
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.

Add tooltip for all the fields in the form

3 participants