Skip to content

Conversation

@basitanees
Copy link
Collaborator

Add attributes to model card additional_info key:

Example Usage:

  • Getting embedding size of embedding models from the model card
  • Getting embedding model, size in IndexModel

@basitanees basitanees self-assigned this May 20, 2025
from aixplain.factories import ModelFactory

model = ModelFactory.get(embedding_model)
self.embedding_size = model.additional_info["embedding_size"]
Copy link
Contributor

Choose a reason for hiding this comment

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

self.embedding_size = model.additional_info.get("embedding_size")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@thiago-aixplain In that case, let me update this as try catch doesnt need to check for embedding_size key retrieval. It can only check if ModelFactory.get doesnt fail

data = super().to_dict()
data["embedding_model"] = self.embedding_model
data["embedding_size"] = self.embedding_size
data["collection_type"] = self.version.split("-", 1)[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any case that version is None? In case not, this is fine. Otherwise, it will crash.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

version shouldnt be none ever as it points to collection name and environment name in the format:
{index_type}-{env}-{team}-{collection_name}


params = supplier_params(name=str(uuid4()), description=str(uuid4()), embedding_model=embedding_model)
index_model = IndexFactory.create(params=params)
assert index_model.embedding_model == embedding_model
Copy link
Contributor

Choose a reason for hiding this comment

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

what will happen if I add index_model = ModelFactory.get(index_model.id) before the assertions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@thiago-aixplain It should work the same way. IndexFactory.create also actually also returns a ModelFactory.get in the end

@basitanees basitanees merged commit 6aa648f into development May 20, 2025
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.

3 participants