mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 10:45:42 +01:00
fix: Docker and sagemaker setup (#1118)
* fix: docker copying extra files * feat: allow configuring mode through env vars * feat: Attempt to build and tag a docker image * fix: run docker on release * fix: typing in prompt transformation * chore: remove tutorial comments
This commit is contained in:
parent
768e5ff505
commit
895588b82a
7 changed files with 67 additions and 15 deletions
|
|
@ -13,7 +13,7 @@ class EmbeddingComponent:
|
|||
@inject
|
||||
def __init__(self) -> None:
|
||||
match settings.llm.mode:
|
||||
case "local":
|
||||
case "local" | "sagemaker":
|
||||
from llama_index.embeddings import HuggingFaceEmbedding
|
||||
|
||||
self.embedding_model = HuggingFaceEmbedding(
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ from llama_index.llms.llama_utils import (
|
|||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Callable
|
||||
|
||||
from llama_index.callbacks import CallbackManager
|
||||
from llama_index.llms import (
|
||||
CompletionResponseGen,
|
||||
|
|
@ -113,10 +111,10 @@ class SagemakerLLM(CustomLLM):
|
|||
context_window: int = Field(
|
||||
description="The maximum number of context tokens for the model."
|
||||
)
|
||||
messages_to_prompt: Callable[..., str] = Field(
|
||||
messages_to_prompt: Any = Field(
|
||||
description="The function to convert messages to a prompt.", exclude=True
|
||||
)
|
||||
completion_to_prompt: Callable[..., str] = Field(
|
||||
completion_to_prompt: Any = Field(
|
||||
description="The function to convert a completion to a prompt.", exclude=True
|
||||
)
|
||||
generate_kwargs: dict[str, Any] = Field(
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ class LLMComponent:
|
|||
|
||||
self.llm = SagemakerLLM(
|
||||
endpoint_name=settings.sagemaker.endpoint_name,
|
||||
messages_to_prompt=messages_to_prompt,
|
||||
completion_to_prompt=completion_to_prompt,
|
||||
)
|
||||
case "openai":
|
||||
from llama_index.llms import OpenAI
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue