mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-30 07:39:38 +00:00
move distribution to yaml files
This commit is contained in:
parent
3802d5acdc
commit
0068d059db
9 changed files with 78 additions and 49 deletions
|
@ -40,7 +40,7 @@ class StackListDistributions(Subcommand):
|
||||||
|
|
||||||
rows = []
|
rows = []
|
||||||
for spec in available_distribution_specs():
|
for spec in available_distribution_specs():
|
||||||
providers = {k.value: v for k, v in spec.providers.items()}
|
providers = {k: v for k, v in spec.providers.items()}
|
||||||
rows.append(
|
rows.append(
|
||||||
[
|
[
|
||||||
spec.distribution_type,
|
spec.distribution_type,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: local-tgi-conda-example
|
name: local-tgi-conda-example
|
||||||
distribution_spec:
|
distribution_spec:
|
||||||
distribution_type: local-plus-tgi-inference
|
distribution_type: local-plus-tgi-inference
|
||||||
description: Use TGI for running LLM inference
|
description: Use TGI (local or with Hugging Face Inference Endpoints for running LLM inference. When using HF Inference Endpoints, you must provide the name of the endpoint).
|
||||||
docker_image: null
|
docker_image: null
|
||||||
providers:
|
providers:
|
||||||
inference: remote::tgi
|
inference: remote::tgi
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
distribution_type: local-ollama
|
||||||
|
description: Like local, but use ollama for running LLM inference
|
||||||
|
docker_image: null
|
||||||
|
providers:
|
||||||
|
inference: remote::ollama
|
||||||
|
safety: meta-reference
|
||||||
|
agentic_system: meta-reference
|
||||||
|
memory: meta-reference-faiss
|
||||||
|
telemetry: console
|
|
@ -0,0 +1,9 @@
|
||||||
|
distribution_type: local-plus-fireworks-inference
|
||||||
|
description: Use Fireworks.ai for running LLM inference
|
||||||
|
docker_image: null
|
||||||
|
providers:
|
||||||
|
inference: remote::fireworks
|
||||||
|
safety: meta-reference
|
||||||
|
agentic_system: meta-reference
|
||||||
|
memory: meta-reference-faiss
|
||||||
|
telemetry: console
|
|
@ -0,0 +1,8 @@
|
||||||
|
distribution_type: local-plus-tgi-inference
|
||||||
|
description: Use TGI (local or with Hugging Face Inference Endpoints for running LLM inference. When using HF Inference Endpoints, you must provide the name of the endpoint).
|
||||||
|
docker_image: null
|
||||||
|
providers:
|
||||||
|
inference: remote::tgi
|
||||||
|
safety: meta-reference
|
||||||
|
agentic_system: meta-reference
|
||||||
|
memory: meta-reference-faiss
|
|
@ -0,0 +1,9 @@
|
||||||
|
distribution_type: local-plus-together-inference
|
||||||
|
description: Use Together.ai for running LLM inference
|
||||||
|
docker_image: null
|
||||||
|
providers:
|
||||||
|
inference: remote::together
|
||||||
|
safety: meta-reference
|
||||||
|
agentic_system: meta-reference
|
||||||
|
memory: meta-reference-faiss
|
||||||
|
telemetry: console
|
|
@ -0,0 +1,9 @@
|
||||||
|
distribution_type: local
|
||||||
|
description: Use code from `llama_toolchain` itself to serve all llama stack APIs
|
||||||
|
docker_image: null
|
||||||
|
providers:
|
||||||
|
inference: meta-reference
|
||||||
|
memory: meta-reference-faiss
|
||||||
|
safety: meta-reference
|
||||||
|
agentic_system: meta-reference
|
||||||
|
telemetry: console
|
21
llama_toolchain/configs/distributions/run.py
Normal file
21
llama_toolchain/configs/distributions/run.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
from llama_toolchain.core.distribution_registry import *
|
||||||
|
import json
|
||||||
|
|
||||||
|
import fire
|
||||||
|
import yaml
|
||||||
|
from llama_toolchain.common.serialize import EnumEncoder
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
for d in available_distribution_specs():
|
||||||
|
file_path = "./configs/distributions/distribution_registry/{}.yaml".format(
|
||||||
|
d.distribution_type
|
||||||
|
)
|
||||||
|
|
||||||
|
with open(file_path, "w") as f:
|
||||||
|
to_write = json.loads(json.dumps(d.dict(), cls=EnumEncoder))
|
||||||
|
f.write(yaml.dump(to_write, sort_keys=False))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
fire.Fire(main)
|
|
@ -5,55 +5,19 @@
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
|
from pathlib import Path
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from .datatypes import * # noqa: F403
|
from .datatypes import * # noqa: F403
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
@lru_cache()
|
# @lru_cache()
|
||||||
def available_distribution_specs() -> List[DistributionSpec]:
|
def available_distribution_specs() -> List[DistributionSpec]:
|
||||||
return [
|
distribution_specs = []
|
||||||
DistributionSpec(
|
for p in Path("llama_toolchain/configs/distributions/distribution_registry").rglob(
|
||||||
distribution_type="local",
|
"*.yaml"
|
||||||
description="Use code from `llama_toolchain` itself to serve all llama stack APIs",
|
):
|
||||||
providers={
|
with open(p, "r") as f:
|
||||||
"inference": "meta-reference",
|
distribution_specs.append(DistributionSpec(**yaml.safe_load(f)))
|
||||||
"memory": "meta-reference-faiss",
|
|
||||||
"safety": "meta-reference",
|
return distribution_specs
|
||||||
"agentic_system": "meta-reference",
|
|
||||||
"telemetry": "console",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
DistributionSpec(
|
|
||||||
distribution_type="local-ollama",
|
|
||||||
description="Like local, but use ollama for running LLM inference",
|
|
||||||
providers={
|
|
||||||
"inference": remote_provider_type("ollama"),
|
|
||||||
"safety": "meta-reference",
|
|
||||||
"agentic_system": "meta-reference",
|
|
||||||
"memory": "meta-reference-faiss",
|
|
||||||
"telemetry": "console",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
DistributionSpec(
|
|
||||||
distribution_type="local-plus-fireworks-inference",
|
|
||||||
description="Use Fireworks.ai for running LLM inference",
|
|
||||||
providers={
|
|
||||||
"inference": remote_provider_type("fireworks"),
|
|
||||||
"safety": "meta-reference",
|
|
||||||
"agentic_system": "meta-reference",
|
|
||||||
"memory": "meta-reference-faiss",
|
|
||||||
"telemetry": "console",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
DistributionSpec(
|
|
||||||
distribution_type="local-plus-tgi-inference",
|
|
||||||
description="Use TGI for running LLM inference",
|
|
||||||
providers={
|
|
||||||
"inference": remote_provider_type("tgi"),
|
|
||||||
"safety": "meta-reference",
|
|
||||||
"agentic_system": "meta-reference",
|
|
||||||
"memory": "meta-reference-faiss",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue