Elffuss BraidHub

kikocis/llama-stack public

7d178b9d269a · 2.5 KiBRawPermalink
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
7from functools import lru_cache
8from typing import List, Optional
9
10from .datatypes import * # noqa: F403
11
12
13@lru_cache()
14def available_distribution_specs() -> List[DistributionSpec]:
15 return [
16 DistributionSpec(
17 distribution_type="local",
18 description="Use code from `llama_toolchain` itself to serve all llama stack APIs",
19 providers={
20 Api.inference: "meta-reference",
21 Api.memory: "meta-reference-faiss",
22 Api.safety: "meta-reference",
23 Api.agentic_system: "meta-reference",
24 },
25 ),
26 DistributionSpec(
27 distribution_type="remote",
28 description="Point to remote services for all llama stack APIs",
29 providers={x: "remote" for x in Api},
30 ),
31 DistributionSpec(
32 distribution_type="local-ollama",
33 description="Like local, but use ollama for running LLM inference",
34 providers={
35 Api.inference: remote_provider_type("ollama"),
36 Api.safety: "meta-reference",
37 Api.agentic_system: "meta-reference",
38 Api.memory: "meta-reference-faiss",
39 },
40 ),
41 DistributionSpec(
42 distribution_type="local-plus-fireworks-inference",
43 description="Use Fireworks.ai for running LLM inference",
44 providers={
45 Api.inference: remote_provider_type("fireworks"),
46 Api.safety: "meta-reference",
47 Api.agentic_system: "meta-reference",
48 Api.memory: "meta-reference-faiss",
49 },
50 ),
51 DistributionSpec(
52 distribution_type="local-plus-together-inference",
53 description="Use Together.ai for running LLM inference",
54 providers={
55 Api.inference: remote_provider_type("together"),
56 Api.safety: "meta-reference",
57 Api.agentic_system: "meta-reference",
58 Api.memory: "meta-reference-faiss",
59 },
60 ),
61 ]
62
63
64@lru_cache()
65def resolve_distribution_spec(distribution_type: str) -> Optional[DistributionSpec]:
66 for spec in available_distribution_specs():
67 if spec.distribution_type == distribution_type:
68 return spec
69 return None