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

[WIP] Support for Capella-hosted embedding models #68

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

Conversation

glennga
Copy link
Collaborator

@glennga glennga commented Jan 30, 2025

Putting a hold on this -- going to wait for the "init" command PR to be pushed.

TODO:

  • tests for different sentence transformers models
  • tests for embedding model use from OpenAI endpoint

…be pushed.

TODO:
[] - tests for different sentence transformers models
[] - tests for embedding model use from OpenAI endpoint
@glennga glennga added the enhancement New feature or request label Jan 30, 2025
@glennga glennga self-assigned this Jan 30, 2025
``AGENT_CATALOG_EMBEDDING_MODEL_AUTH``
The field used in the authorization header of all OpenAI-standard client embedding requests.
For embedding models hosted by OpenAI, this field refers to the API key.
For embedding models hosted by Capella, this field refers to the Base64-encoded value of
Copy link
Collaborator

Choose a reason for hiding this comment

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

users provide the database conn uname and password
this field would not be a requirement and instead the request can contain the header with uname and pwd
i assume we dont need the user to get this encoded string

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If the users provide this field, we will use this (as we want to support not just Capella, but all OpenAI-standard endpoints) -- but yes, we can use the AGENT_CATALOG_USERNAME and AGENT_CATALOG_PASSWORD variables to create this encoding string if AGENT_CATALOG_EMBEDDING_MODEL_AUTH is not set.

"of each catalog entry.",
examples=["sentence-transformers/all-MiniLM-L12-v2"],
embedding_model: EmbeddingModel = pydantic.Field(
description="Embedding model used for all descriptions in the catalog.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
description="Embedding model used for all descriptions in the catalog.",
description="Embedding model used to generate embedding for tool/prompt descriptions to store in the catalogs.",

something like this would be more suitable


# Grab our local tool embedding model...
local_tool_catalog_path = self.catalog_path / DEFAULT_TOOL_CATALOG_NAME
if local_tool_catalog_path.exists():
with local_tool_catalog_path.open("r") as fp:
local_tool_catalog = CatalogDescriptor.model_validate_json(fp.read())
collected_embedding_model_names.add(local_tool_catalog.embedding_model)
collected_embedding_models.add(local_tool_catalog.embedding_model)

# ...and now our local prompt embedding model.
Copy link
Collaborator

@TJ202 TJ202 Jan 31, 2025

Choose a reason for hiding this comment

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

do users have the provision to specify different models for tool and prompt each?
if im not wrong, AGENT_CATALOG_EMBEDDING_MODEL defines the embedding model used and its for both prompts and tools

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

they shouldn't, but this is the constraint we have now (because right now we have two metadata collections). in the future, we want to remove this

The embedding model that Agent Catalog will use when indexing and querying tools and prompts.
This *must* be a valid embedding model that is supported by the :python:`sentence_transformers.SentenceTransformer`
class.
class *or* the name of a model that can be used from the endpoint specified in the environment variable
``AGENT_CATALOG_EMBEDDING_MODEL_URL``.
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we specify the allowed models for openai in the docs
what can the value for this and url be to hit the /endpoint route

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there aren't really allowed models, its whatever the model service provides (given that the model supports function calling, etc...)

)
base_url: typing.Optional[str] = pydantic.Field(
description="The base URL of the embedding model."
"This field must be specified is using a non-SentenceTransformers-based model.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"This field must be specified is using a non-SentenceTransformers-based model.",
"This field must be specified if using a non-SentenceTransformers-based model.",



class EmbeddingModel(pydantic.BaseModel):
kind: typing.Literal["sentence-transformers", "openai"] = pydantic.Field(
Copy link
Collaborator

Choose a reason for hiding this comment

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

for caepella models, what is the kind?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

openai (because Capella is supposed to be OpenAI-compliant)

)
name: str = pydantic.Field(
description="The name of the embedding model being used.",
examples=["all-MiniLM-L12-v2", "https://12fs345d.apps.cloud.couchbase.com"],
Copy link
Collaborator

Choose a reason for hiding this comment

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

name of model if its on capella is intfloat/e5-mistral-7b-instruct
last i checked this is the only embedding model they have hosted

Copy link
Collaborator

Choose a reason for hiding this comment

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

https://12fs345d.apps.cloud.couchbase.com is more of the endpoint fqdn url if im not wrong

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yep, this name example is wrong 😅

@ThejasNU
Copy link
Collaborator

ThejasNU commented Feb 4, 2025

Putting a hold on this -- going to wait for the "init" command PR to be pushed.

it would be better if you merge this to dev branch instead of master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants