| 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. |
| 2 | # All rights reserved. |
| 3 | # |
| 4 | # This source code is licensed under the terms described in the LICENSE file in |
| 5 | # the root directory of this source tree. |
| 6 | |
| 7 | from typing import List |
| 8 | |
| 9 | from llama_stack.distribution.datatypes import * # noqa: F403 |
| 10 | |
| 11 | |
| 12 | EMBEDDING_DEPS = [ |
| 13 | "blobfile", |
| 14 | "chardet", |
| 15 | "pypdf", |
| 16 | "tqdm", |
| 17 | "numpy", |
| 18 | "scikit-learn", |
| 19 | "scipy", |
| 20 | "nltk", |
| 21 | "sentencepiece", |
| 22 | "transformers", |
| 23 | # this happens to work because special dependencies are always installed last |
| 24 | # so if there was a regular torch installed first, this would be ignored |
| 25 | # we need a better way to do this to identify potential conflicts, etc. |
| 26 | # for now, this lets us significantly reduce the size of the container which |
| 27 | # does not have any "local" inference code (and hence does not need GPU-enabled torch) |
| 28 | "torch --index-url https://download.pytorch.org/whl/cpu", |
| 29 | "sentence-transformers --no-deps", |
| 30 | ] |
| 31 | |
| 32 | |
| 33 | def available_providers() -> List[ProviderSpec]: |
| 34 | return [ |
| 35 | InlineProviderSpec( |
| 36 | api=Api.memory, |
| 37 | provider_id="meta-reference", |
| 38 | pip_packages=EMBEDDING_DEPS + ["faiss-cpu"], |
| 39 | module="llama_stack.providers.impls.meta_reference.memory", |
| 40 | config_class="llama_stack.providers.impls.meta_reference.memory.FaissImplConfig", |
| 41 | ), |
| 42 | remote_provider_spec( |
| 43 | Api.memory, |
| 44 | AdapterSpec( |
| 45 | adapter_id="chromadb", |
| 46 | pip_packages=EMBEDDING_DEPS + ["chromadb-client"], |
| 47 | module="llama_stack.providers.adapters.memory.chroma", |
| 48 | ), |
| 49 | ), |
| 50 | remote_provider_spec( |
| 51 | Api.memory, |
| 52 | AdapterSpec( |
| 53 | adapter_id="pgvector", |
| 54 | pip_packages=EMBEDDING_DEPS + ["psycopg2-binary"], |
| 55 | module="llama_stack.providers.adapters.memory.pgvector", |
| 56 | config_class="llama_stack.providers.adapters.memory.pgvector.PGVectorConfig", |
| 57 | ), |
| 58 | ), |
| 59 | remote_provider_spec( |
| 60 | api=Api.memory, |
| 61 | adapter=AdapterSpec( |
| 62 | adapter_id="sample", |
| 63 | pip_packages=[], |
| 64 | module="llama_stack.providers.adapters.memory.sample", |
| 65 | config_class="llama_stack.providers.adapters.memory.sample.SampleConfig", |
| 66 | ), |
| 67 | ), |
| 68 | ] |