mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-07 19:12:09 +00:00
added back secretstr and ran pre-commit
This commit is contained in:
parent
f7e5ae5dfc
commit
3298e50105
5 changed files with 7 additions and 10 deletions
|
@ -7,7 +7,7 @@
|
||||||
import os
|
import os
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field, SecretStr
|
||||||
|
|
||||||
from llama_stack.schema_utils import json_schema_type
|
from llama_stack.schema_utils import json_schema_type
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class NVIDIAConfig(BaseModel):
|
||||||
default_factory=lambda: os.getenv("NVIDIA_BASE_URL", "https://integrate.api.nvidia.com"),
|
default_factory=lambda: os.getenv("NVIDIA_BASE_URL", "https://integrate.api.nvidia.com"),
|
||||||
description="A base url for accessing the NVIDIA NIM",
|
description="A base url for accessing the NVIDIA NIM",
|
||||||
)
|
)
|
||||||
api_key: Optional[str] = Field(
|
api_key: Optional[SecretStr] = Field(
|
||||||
default_factory=lambda: os.getenv("NVIDIA_API_KEY"),
|
default_factory=lambda: os.getenv("NVIDIA_API_KEY"),
|
||||||
description="The NVIDIA API key, only needed of using the hosted service",
|
description="The NVIDIA API key, only needed of using the hosted service",
|
||||||
)
|
)
|
||||||
|
|
|
@ -85,7 +85,7 @@ class NVIDIAInferenceAdapter(Inference, ModelRegistryHelper):
|
||||||
# make sure the client lives longer than any async calls
|
# make sure the client lives longer than any async calls
|
||||||
self._client = AsyncOpenAI(
|
self._client = AsyncOpenAI(
|
||||||
base_url=f"{self._config.url}/v1",
|
base_url=f"{self._config.url}/v1",
|
||||||
api_key=(self._config.api_key if self._config.api_key else "NO KEY"),
|
api_key=(self._config.api_key.get_secret_value() if self._config.api_key else "NO KEY"),
|
||||||
timeout=self._config.timeout,
|
timeout=self._config.timeout,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,11 @@
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from llama_stack.distribution.datatypes import Provider, ToolGroupInput
|
|
||||||
from llama_stack.providers.remote.inference.nvidia import NVIDIAConfig
|
|
||||||
from llama_stack.providers.remote.inference.nvidia.models import MODEL_ENTRIES
|
|
||||||
from llama_stack.templates.template import DistributionTemplate, RunConfigSettings, get_model_registry
|
|
||||||
from llama_stack.distribution.datatypes import ModelInput, Provider, ShieldInput, ToolGroupInput
|
from llama_stack.distribution.datatypes import ModelInput, Provider, ShieldInput, ToolGroupInput
|
||||||
from llama_stack.providers.remote.inference.nvidia import NVIDIAConfig
|
from llama_stack.providers.remote.inference.nvidia import NVIDIAConfig
|
||||||
|
from llama_stack.providers.remote.inference.nvidia.models import MODEL_ENTRIES
|
||||||
from llama_stack.providers.remote.safety.nvidia import NVIDIASafetyConfig
|
from llama_stack.providers.remote.safety.nvidia import NVIDIASafetyConfig
|
||||||
from llama_stack.templates.template import DistributionTemplate, RunConfigSettings
|
from llama_stack.templates.template import DistributionTemplate, RunConfigSettings, get_model_registry
|
||||||
|
|
||||||
|
|
||||||
def get_distribution_template() -> DistributionTemplate:
|
def get_distribution_template() -> DistributionTemplate:
|
||||||
|
|
|
@ -10630,4 +10630,4 @@
|
||||||
],
|
],
|
||||||
"type": "generator"
|
"type": "generator"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,4 +290,4 @@
|
||||||
"metadata": null
|
"metadata": null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue