Elffuss BraidHub

kikocis/llama-stack public

7e11e7246f77 · 3.1 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 Api.telemetry: "console",
25 },
26 ),
27 DistributionSpec(
28 distribution_type="remote",
29 description="Point to remote services for all llama stack APIs",
30 providers={
31 **{x: "remote" for x in Api},
32 Api.telemetry: "console",
33 },
34 ),
35 DistributionSpec(
36 distribution_type="local-ollama",
37 description="Like local, but use ollama for running LLM inference",
38 providers={
39 Api.inference: remote_provider_type("ollama"),
40 Api.safety: "meta-reference",
41 Api.agentic_system: "meta-reference",
42 Api.memory: "meta-reference-faiss",
43 Api.telemetry: "console",
44 },
45 ),
46 DistributionSpec(
47 distribution_type="local-plus-fireworks-inference",
48 description="Use Fireworks.ai for running LLM inference",
49 providers={
50 Api.inference: remote_provider_type("fireworks"),
51 Api.safety: "meta-reference",
52 Api.agentic_system: "meta-reference",
53 Api.memory: "meta-reference-faiss",
54 Api.telemetry: "console",
55 },
56 ),
57 DistributionSpec(
58 distribution_type="local-plus-together-inference",
59 description="Use Together.ai for running LLM inference",
60 providers={
61 Api.inference: remote_provider_type("together"),
62 Api.safety: "meta-reference",
63 Api.agentic_system: "meta-reference",
64 Api.memory: "meta-reference-faiss",
65 Api.telemetry: "console",
66 },
67 ),
68 DistributionSpec(
69 distribution_type="local-plus-tgi-inference",
70 description="Use TGI for running LLM inference",
71 providers={
72 Api.inference: remote_provider_type("tgi"),
73 Api.safety: "meta-reference",
74 Api.agentic_system: "meta-reference",
75 Api.memory: "meta-reference-faiss",
76 },
77 ),
78 ]
79
80
81@lru_cache()
82def resolve_distribution_spec(
83 distribution_type: str,
84) -> Optional[DistributionSpec]:
85 for spec in available_distribution_specs():
86 if spec.distribution_type == distribution_type:
87 return spec
88 return None