Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add tags field for models with dynamic and user-defined population #629

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

HabebNawatha
Copy link

  • Implemented a Python function to extract tags from the model identifier field for dynamic population.
  • Enabled users to specify tags manually when registering a model.
  • Tags are now included when retrieving model data, enabling enhanced functionality like filtering and categorization based on tags.

What does this PR do?

This PR enhances the model registration and retrieval process by adding support for tags. It introduces a Python function that automatically extracts tags from the model identifier field, allowing dynamic tag population. Additionally, it gives users the ability to specify tags manually during model registration. As a result, tags are now included in the model data when retrieved. enabling advanced features such as filtering and categorization based on tags.

Test Plan

  • Verified that tags are dynamically populated when a model identifier is provided.
  • Confirmed that users can manually add tags during model registration.
  • Ensured that tags are correctly included in the model data when retrieved.
  • Tested the functionality by calling various APIs, such as models/list, to ensure the tags are displayed in the output.
  • Verified that registering a model with manually added tags successfully stores and includes the tags in the retrieved data.
  • Expected output:
[
    {
        "identifier": "meta-llama/Llama-3.2-1B-Instruct",
        "provider_resource_id": "llama3.2:1b-instruct-fp16",
        "provider_id": "ollama",
        "type": "model",
        "metadata": {},
        "tags": {
            "llama_version": "3.2",
            "model_type": "Instruct",
            "model_size": "1B"
        },
        "model_type": "llm"
    }
]

Reproduction instructions

  1. Register a model with a specified identifier, ensuring the tags field is populated dynamically.
  2. Retrieve the model data and confirm that the tags are included.
  3. Call the models/list API to confirm that the tags are correctly displayed in the output.
  4. Register a model and manually add tags, then verify that the tags are stored and retrieved correctly.

Sources

Please link relevant resources if necessary.
N/A

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Ran pre-commit to handle lint / formatting issues.
  • Read the contributor guideline,
    Pull Request section?
  • Updated relevant documentation.
  • Wrote necessary unit or integration tests.

- Implemented a Python function to extract tags from the model identifier field for dynamic population.
- Enabled users to specify tags manually when registering a model.
- Tags are now included when retrieving model data.

Signed-off-by: Habeb Nawatha <[email protected]>
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants