Add Inference embed and rerank#436
Conversation
|
Haven't fully reviewed yet, but one top level question that comes to mind is what happens if someone still has the inference-plugin as a dependency on their project? |
Haven't reviewed quite yet either, but my expectation is during runtime the plugin code would try and overwrite the existing methods, and fail silently. I'm saying fail silently because I think we just log if there's something erroneous in the plugin loading process. I'd need to double check though, it's something we should definitely test around. |
| class EmbedModel(Enum): | ||
| Multilingual_E5_Large = "multilingual-e5-large" | ||
| Pinecone_Sparse_English_V0 = "pinecone-sparse-english-v0" | ||
|
|
||
|
|
||
| class RerankModel(Enum): | ||
| Bge_Reranker_V2_M3 = "bge-reranker-v2-m3" | ||
| Cohere_Rerank_3_5 = "cohere-rerank-3.5" | ||
| Pinecone_Rerank_v0 = "pinecone-rerank-v0" |
There was a problem hiding this comment.
the model enums are nice, user-friendly additions
Wonder if it makes sense to do something similar for the model-specific parameters supported by each model (separate PR)
There was a problem hiding this comment.
Thanks, yeah, I think it's quite nice and want to bring a similar strategy to other places in the SDK. The fields are loosely typed as Union[RerankModel, str] and Union[EmbedModel, str] so you can still pass whatever you want but it's nice to have some structure indicating what values are available. I hate when I'm trying to do something and need to go lookup what string values are valid. E.g. what cloud regions actually exist for serverless?
austin-denoble
left a comment
There was a problem hiding this comment.
Looks great, thanks for pulling the internals of these plugins into the client.


Problem
We want to migrate the content of the inference plugin into the core SDK. This should improve UX by allowing code completion to function properly.
Solution
Pineconeparent class when someone attempts to use inference capabilities. This saves a little bit of startup overhead if someone is not using these functions.pinecone-plugin-inferencepackage, since we now have all the functionality of that plugin in the core SDK.In addition to copy & modify:
RerankModelandEmbedModel, to serve mainly as documentation and support for code suggestions. You can still pass in any string you like to keep this forward compatible with any future models.inferencenamespace via future plugins if desired. I should really define a base class that does this scan for all classes by default but have not gotten around to it yet.Usage: Embed
Or, if you'd like you can import an enum of available options
Or, for the very clever/lazy, the enum is also attached to the
inferencenamespaceUsage: Rerank
Same enum mechanic is now available for Rerank options
Type of Change