2121from datacustomcode .einstein_predictions_config import einstein_predictions_config
2222from datacustomcode .file .path .default import DefaultFindFilePath
2323from datacustomcode .function .base import BaseRuntime
24- from datacustomcode .llm_gateway .default import DefaultLLMGateway
24+ from datacustomcode .llm_gateway .base import LLMGateway
25+ from datacustomcode .llm_gateway_config import llm_gateway_config
2526
2627
2728class Runtime (BaseRuntime ):
@@ -46,7 +47,7 @@ def __new__(cls):
4647 raise RuntimeError (
4748 "Runtime can only be instantiated once by the SDK.\n \n "
4849 "Do not instantiate it yourself. Accept it as a parameter:\n \n "
49- " from datacustomcode.runtime. function.RunTime import Function \n "
50+ " from datacustomcode.function.runtime import Runtime \n "
5051 " \n "
5152 " def function(request: dict, runtime: Runtime) -> dict:\n "
5253 " response = {...}\n "
@@ -65,13 +66,19 @@ def __init__(self) -> None:
6566 super ().__init__ ()
6667
6768 # Initialize resources
68- self ._llm_gateway = DefaultLLMGateway ()
69+ self ._llm_gateway : Optional [ LLMGateway ] = None
6970 self ._file = DefaultFindFilePath ()
7071 self ._einstein_predictions : Optional [EinsteinPredictions ] = None
7172
7273 @property
73- def llm_gateway (self ) -> DefaultLLMGateway :
74- """Access LLM operations."""
74+ def llm_gateway (self ) -> LLMGateway :
75+ if self ._llm_gateway is None :
76+ if llm_gateway_config .llm_gateway_config is None :
77+ raise RuntimeError (
78+ "LLM Gateway is not configured. "
79+ "Add 'llm_gateway_config' section to config.yaml"
80+ )
81+ self ._llm_gateway = llm_gateway_config .llm_gateway_config .to_object ()
7582 return self ._llm_gateway
7683
7784 @property
0 commit comments