Skip to content

Commit a68b42c

Browse files
Review comments
1 parent 7bc5fa3 commit a68b42c

3 files changed

Lines changed: 6 additions & 18 deletions

File tree

src/datacustomcode/client.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ def __new__(
119119
spark_provider: Optional["BaseSparkSessionProvider"] = None,
120120
code_type: str = "script",
121121
) -> Client:
122-
if "function" in code_type:
123-
return cls._new_function_client()
124122

125123
if cls._instance is None:
126124
cls._instance = super().__new__(cls)
@@ -175,16 +173,6 @@ def __new__(
175173
raise ValueError("Cannot set reader or writer after client is initialized")
176174
return cls._instance
177175

178-
@classmethod
179-
def _new_function_client(cls) -> Client:
180-
cls._instance = super().__new__(cls)
181-
cls._instance._proxy = (
182-
config.proxy_config.to_object() # type: ignore
183-
if config.proxy_config is not None
184-
else None
185-
)
186-
return cls._instance
187-
188176
def read_dlo(self, name: str) -> PySparkDataFrame:
189177
"""Read a DLO from Data Cloud.
190178

src/datacustomcode/runtime/function.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Runtime(BaseRuntime):
2828
NOTE: Do not instantiate this class directly.
2929
It will be provided to your function by the SDK:
3030
31-
def function(request: dict, client: FunctionClient) -> dict:
31+
def function(request: dict, runtime: RunTime) -> dict:
3232
response = {...}
3333
return response
3434
@@ -42,11 +42,11 @@ def __new__(cls):
4242
with cls._lock:
4343
if cls._instance is not None:
4444
raise RuntimeError(
45-
"FunctionRuntime can only be instantiated once by the SDK.\n\n"
45+
"Runtime can only be instantiated once by the SDK.\n\n"
4646
"Do not instantiate it yourself. Accept it as a parameter:\n\n"
47-
" from datacustomcode.runtime import Function\n"
47+
" from datacustomcode.runtime.function.RunTime import Function\n"
4848
" \n"
49-
" def function(request: dict, runtime: FunctionRuntime) -> dict:\n"
49+
" def function(request: dict, runtime: Runtime) -> dict:\n"
5050
" response = {...}\n"
5151
" return response"
5252
)

src/datacustomcode/templates/function/payload/entrypoint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def chunk_text(text: str, chunk_size: int = 1000) -> List[str]:
3838
return chunks
3939

4040

41-
def function(request: dict, runTime: Runtime) -> dict:
41+
def function(request: dict, runtime: Runtime) -> dict:
4242
logger.info("Inside Function")
4343
logger.info(request)
4444

@@ -48,7 +48,7 @@ def function(request: dict, runTime: Runtime) -> dict:
4848

4949
builder = GenerateTextRequestBuilder()
5050
llm_request = builder.set_prompt("Hello").set_model("modelName").build()
51-
llm_response = runTime.llm_gateway.generate_text(llm_request)
51+
llm_response = runtime.llm_gateway.generate_text(llm_request)
5252

5353
if llm_response.is_success:
5454
print(llm_response.text)

0 commit comments

Comments
 (0)