diff --git a/examples/examples/openai/create-completion-async.py b/examples/examples/openai/create-completion-async.py index c74547d..8a35b32 100644 --- a/examples/examples/openai/create-completion-async.py +++ b/examples/examples/openai/create-completion-async.py @@ -27,8 +27,8 @@ async def main(): result = await openai.Completion.acreate( model="text-davinci-003", - promptTemplate="Hello world {{ name }}", - promptInputs={"name": "Vivek"}, + prompt_template="Hello world {{ name }}", + prompt_inputs={"name": "Vivek"}, stream=True, ) diff --git a/examples/examples/openai/create-completion.py b/examples/examples/openai/create-completion.py index a02447d..ac0f267 100644 --- a/examples/examples/openai/create-completion.py +++ b/examples/examples/openai/create-completion.py @@ -22,8 +22,8 @@ result = openai.Completion.create( model="text-davinci-003", - promptTemplate="Hello world {{ name }}", - promptInputs={"name": "test"}, + prompt_template="Hello world {{ name }}", + prompt_inputs={"name": "test"}, ) print("Result: ", result) diff --git a/examples/examples/openai/create-multiple-calls.py b/examples/examples/openai/create-multiple-calls.py index 311557a..7d6967a 100644 --- a/examples/examples/openai/create-multiple-calls.py +++ b/examples/examples/openai/create-multiple-calls.py @@ -28,8 +28,8 @@ completion_result = openai.Completion.create( model="text-davinci-003", - promptTemplate="Hello world {{ name }}", - promptInputs={"name": "test"}, + prompt_template="Hello world {{ name }}", + prompt_inputs={"name": "test"}, ) print("Completion result: ", completion_result) diff --git a/package/gentrace/providers/llms/openai.py b/package/gentrace/providers/llms/openai.py index 0d19913..cae1971 100644 --- a/package/gentrace/providers/llms/openai.py +++ b/package/gentrace/providers/llms/openai.py @@ -61,22 +61,22 @@ def create_step_run( def intercept_completion(original_fn): @classmethod def wrapper(cls, *args, **kwargs): - prompt_template = kwargs.get("promptTemplate") - prompt_inputs = kwargs.get("promptInputs") + prompt_template = kwargs.get("prompt_template") + prompt_inputs = kwargs.get("prompt_inputs") base_completion_options = { k: v for k, v in kwargs.items() - if k not in ["promptTemplate", "promptInputs"] + if k not in ["prompt_template", "prompt_inputs"] } if "prompt" in base_completion_options: raise ValueError( - "The prompt attribute cannot be provided when using the Gentrace SDK. Use promptTemplate and promptInputs instead." + "The prompt attribute cannot be provided when using the Gentrace SDK. Use prompt_template and prompt_inputs instead." ) if not prompt_template: raise ValueError( - "The promptTemplate attribute must be provided when using the Gentrace SDK." + "The prompt_template attribute must be provided when using the Gentrace SDK." ) rendered_prompt = pystache.render(prompt_template, prompt_inputs) @@ -103,23 +103,23 @@ def wrapper(cls, *args, **kwargs): def intercept_completion_async(original_fn): @classmethod async def wrapper(cls, *args, **kwargs): - prompt_template = kwargs.get("promptTemplate") - prompt_inputs = kwargs.get("promptInputs") + prompt_template = kwargs.get("prompt_template") + prompt_inputs = kwargs.get("prompt_inputs") stream = kwargs.get("stream") base_completion_options = { k: v for k, v in kwargs.items() - if k not in ["promptTemplate", "promptInputs"] + if k not in ["prompt_template", "prompt_inputs"] } if "prompt" in base_completion_options: raise ValueError( - "The prompt attribute cannot be provided when using the Gentrace SDK. Use promptTemplate and promptInputs instead." + "The prompt attribute cannot be provided when using the Gentrace SDK. Use prompt_template and prompt_inputs instead." ) if not prompt_template: raise ValueError( - "The promptTemplate attribute must be provided when using the Gentrace SDK." + "The prompt_template attribute must be provided when using the Gentrace SDK." ) if stream: diff --git a/package/gentrace/providers/utils.py b/package/gentrace/providers/utils.py index 1d9cb65..33d6c3c 100644 --- a/package/gentrace/providers/utils.py +++ b/package/gentrace/providers/utils.py @@ -1,5 +1,7 @@ from datetime import datetime +__all__ = ["to_date_string"] + def to_date_string(time_value): return (