Find answers from the community

Updated last year

e.g. of current

At a glance

The post provides an example of using the StorageContext.from_defaults() method to create a FilteredDocumentVectorStore instance. In the comments, a community member suggests that the "Service context" is deprecated and provides migration recommendations:

a) Use "Settings" for any global defaults
b) Pass in the LLM/embed model as needed for specific APIs, e.g. VectorStoreIndex(..., embed_model=embed_model), index.as_query_engine(..., llm=llm)

Another community member acknowledges the feedback and plans to create a container called "NotServiceContext" to manage their global defaults.

e.g. of current

Plain Text
return StorageContext.from_defaults(
            vector_store=FilteredDocumentVectorStore(
                client=store_config.qdrant_client,
                collection_name=f"{store_config.index_name}"
            )
        )
L
i
5 comments
Service context still works! But deprecated with a warning for now.

If you want to migrate
a) Use Settings for any global defaults
b) pass in llm/embed model as needed for specific APIs

VectorStoreIndex(..., embed_model=embed_model)

index.as_query_engine(..., llm=llm)
Got it. I have no global defaults, so I’ll make a container for those values called something like NotServiceContext and have my subclasses automatically pass those to the constructor
Let me know if you have any questions! Hopefully intellisense helps you with which kwargs go where 🙂
Will do. I don’t think it’ll be too bad.
Add a reply
Sign up and join the conversation on Discord