weaviate-python-client icon indicating copy to clipboard operation
weaviate-python-client copied to clipboard

Vectorizer runtime config

Open dirkkul opened this issue 1 year ago • 1 comments

Adds the possibility of typed input for runtime module configuration of api-keys, rate limits and other things that can be affected by headers at the request time.

Currently only adds this for OpenAI, Cohere and VoyageAI as these two are already supported by the batch vectorization and need the rate-limit input.

Also adds some tuning of the dynamic batching for low-rate-limit api keys

Syntax:

    collection = client.collections.create(
        name="Test",
        properties=[
            wvc.config.Property(name="url", data_type=wvc.config.DataType.TEXT),
            wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT),
            wvc.config.Property(name="raw", data_type=wvc.config.DataType.TEXT),
            wvc.config.Property(name="sha", data_type=wvc.config.DataType.TEXT),
        ],
        vectorizer_config=[
            wvc.config.Configure.NamedVectors.text2vec_cohere(name="cohereFirst"),
            wvc.config.Configure.NamedVectors.text2vec_cohere(name="cohereSecond"),
        ]
    )
integrations=[
            wvc.init.Integrations.cohere(
                api_key="KEY"
            ),
            wvc.init.Integrations.openai(
                api_key="KEY", base_url ="...."
            ),
            wvc.init.Integrations.voyageai(
                api_key="KEY",
            ),
        ]
client.integrations.configure(integrations)

dirkkul avatar Mar 26 '24 13:03 dirkkul

Codecov Report

Attention: Patch coverage is 75.11962% with 52 lines in your changes are missing coverage. Please review.

Project coverage is 94.63%. Comparing base (d604db8) to head (577a2c9). Report is 227 commits behind head on main.

Files Patch % Lines
weaviate/collections/batch/base.py 39.02% 50 Missing :warning:
weaviate/collections/batch/client.py 95.83% 1 Missing :warning:
weaviate/collections/batch/collection.py 93.75% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #981      +/-   ##
==========================================
- Coverage   95.23%   94.63%   -0.61%     
==========================================
  Files         173      181       +8     
  Lines       17836    18641     +805     
==========================================
+ Hits        16986    17640     +654     
- Misses        850     1001     +151     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar May 03 '24 22:05 codecov-commenter