| 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 Optional |
| 8 | |
| 9 | from llama_models.schema_utils import json_schema_type |
| 10 | from pydantic import BaseModel, Field |
| 11 | |
| 12 | |
| 13 | @json_schema_type |
| 14 | class TGIImplConfig(BaseModel): |
| 15 | url: str = Field( |
| 16 | description="The URL for the TGI endpoint (e.g. 'http://localhost:8080')", |
| 17 | ) |
| 18 | api_token: Optional[str] = Field( |
| 19 | default=None, |
| 20 | description="A bearer token if your TGI endpoint is protected.", |
| 21 | ) |
| 22 | |
| 23 | |
| 24 | @json_schema_type |
| 25 | class InferenceEndpointImplConfig(BaseModel): |
| 26 | endpoint_name: str = Field( |
| 27 | description="The name of the Hugging Face Inference Endpoint in the format of '{namespace}/{endpoint_name}' (e.g. 'my-cool-org/meta-llama-3-1-8b-instruct-rce'). Namespace is optional and will default to the user account if not provided.", |
| 28 | ) |
| 29 | api_token: Optional[str] = Field( |
| 30 | default=None, |
| 31 | description="Your Hugging Face user access token (will default to locally saved token if not provided)", |
| 32 | ) |
| 33 | |
| 34 | |
| 35 | @json_schema_type |
| 36 | class InferenceAPIImplConfig(BaseModel): |
| 37 | model_id: str = Field( |
| 38 | description="The model ID of the model on the Hugging Face Hub (e.g. 'meta-llama/Meta-Llama-3.1-70B-Instruct')", |
| 39 | ) |
| 40 | api_token: Optional[str] = Field( |
| 41 | default=None, |
| 42 | description="Your Hugging Face user access token (will default to locally saved token if not provided)", |
| 43 | ) |