From 53d1d1eb5f7d72f408bcb6f364d9ab480dd5e9ab Mon Sep 17 00:00:00 2001 From: Joschka Braun Date: Wed, 11 Oct 2023 07:57:28 +0200 Subject: [PATCH] feat: rename variable --- README.md | 19 ++++++++++++------- parea/benchmark.py | 8 ++++---- parea/client.py | 4 ++-- pyproject.toml | 2 +- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 9300bca4..c7956c83 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,9 @@ code & prompts without waiting for all previous, valid LLM responses. Simply add [a local redis cache](https://redis.io/docs/getting-started/install-stack/): ```python -from parea import init +from parea import init, RedisCache -init() +init(cache=RedisCache()) ``` Above will use the default redis cache at `localhost:6379` with no password. You can also specify your redis database by: @@ -44,13 +44,15 @@ Above will use the default redis cache at `localhost:6379` with no password. You from parea import init, RedisCache cache = RedisCache( - host=os.getenv("REDIS_HOST", "localhost"), # default value - port=int(os.getenv("REDIS_PORT", 6379)), # default value - password=os.getenv("REDIS_PASSWORT", None) # default value + host=os.getenv("REDIS_HOST", "localhost"), # default value + port=int(os.getenv("REDIS_PORT", 6379)), # default value + password=os.getenv("REDIS_PASSWORT", None) # default value ) -init(cache=cache) # default value +init(cache=cache) ``` +If you set `cache = None` for `init`, no cache will be used. + ### Automatically log all your LLM call traces You can automatically log all your LLM traces to the Parea dashboard by setting the `PAREA_API_KEY` environment variable or specifying it in the `init` function. @@ -60,7 +62,10 @@ in your local setup & code. ```python from parea import init -init(api_key=os.getenv("PAREA_API_KEY")) # default value +init( + api_key=os.getenv("PAREA_API_KEY"), # default value + cache=... +) ``` diff --git a/parea/benchmark.py b/parea/benchmark.py index badf7e36..a236b1cc 100644 --- a/parea/benchmark.py +++ b/parea/benchmark.py @@ -50,16 +50,16 @@ def async_wrapper(fn, **kwargs): def run_benchmark(args): parser = argparse.ArgumentParser() - parser.add_argument("--user_func", help="User function to test e.g., path/to/user_code.py:argument_chain", type=str) - parser.add_argument("--inputs", help="Path to the input CSV file", type=str) + parser.add_argument("--func", help="Function to test e.g., path/to/my_code.py:argument_chain", type=str) + parser.add_argument("--csv_path", help="Path to the input CSV file", type=str) parser.add_argument("--redis_host", help="Redis host", type=str, default=os.getenv("REDIS_HOST", "localhost")) parser.add_argument("--redis_port", help="Redis port", type=int, default=int(os.getenv("REDIS_PORT", 6379))) parser.add_argument("--redis_password", help="Redis password", type=str, default=None) parsed_args = parser.parse_args(args) - fn = load_from_path(*parsed_args.user_func.rsplit(":", 1)) + fn = load_from_path(*parsed_args.func.rsplit(":", 1)) - data_inputs = read_input_file(parsed_args.inputs) + data_inputs = read_input_file(parsed_args.csv_path) redis_logs_key = f"parea-trace-logs-{int(time.time())}" os.putenv("_parea_redis_logs_key", redis_logs_key) diff --git a/parea/client.py b/parea/client.py index cec37da6..dc8b1d4c 100644 --- a/parea/client.py +++ b/parea/client.py @@ -24,7 +24,7 @@ class Parea: api_key: str = field(init=True, default="") _client: HTTPClient = field(init=False, default=HTTPClient()) - cache: Cache = field(init=True, default=RedisCache()) + cache: Cache = field(init=True, default=None) def __attrs_post_init__(self): self._client.set_api_key(self.api_key) @@ -96,7 +96,7 @@ async def arecord_feedback(self, data: FeedbackRequest) -> None: _initialized_parea_wrapper = False -def init(api_key: str = os.getenv("PAREA_API_KEY"), cache: Cache = RedisCache()) -> None: +def init(api_key: str = os.getenv("PAREA_API_KEY"), cache: Cache = None) -> None: Parea(api_key=api_key, cache=cache) diff --git a/pyproject.toml b/pyproject.toml index fde9ac0c..894e7ece 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "parea-ai" packages = [{ include = "parea" }] -version = "0.2.8" +version = "0.2.9" description = "Parea python sdk" readme = "README.md" authors = ["joel-parea-ai "]