From 388fcf66d6acea1d69a4f49f9bdc78bab779e55c Mon Sep 17 00:00:00 2001 From: Robert Guss Date: Wed, 17 Apr 2024 14:45:05 -0400 Subject: [PATCH 1/3] update JS SDK param options.experiment docs --- js/src/logger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/logger.ts b/js/src/logger.ts index e350e417..17a44daa 100644 --- a/js/src/logger.ts +++ b/js/src/logger.ts @@ -1093,7 +1093,7 @@ type InitializedExperiment = * * @param options Options for configuring init(). * @param options.project The name of the project to create the experiment in. Must specify at least one of `project` or `projectId`. - * @param options.experiment The name of the experiment to create. If not specified, a name will be generated automatically. + * @param options.experiment The name of the experiment to create. If not specified, a name will be generated automatically. If you use an existing experiment name, by default it will create a new experiment with that name as a prefix. If you want to update an existing experiment, you can set `update=True`. If you want to open an existing experiment in read-only mode, you can set `open=True`. * @param options.description An optional description of the experiment. * @param options.dataset (Optional) A dataset to associate with the experiment. You can pass in the name of the dataset (in the same project) or a dataset object (from any project). * @param options.update If the experiment already exists, continue logging to it. From 643f0cd4a06877834039a16ac568df0b49aa40a4 Mon Sep 17 00:00:00 2001 From: Robert Guss Date: Wed, 17 Apr 2024 14:47:38 -0400 Subject: [PATCH 2/3] update JS and Python SDK experiment param docs --- js/src/logger.ts | 2 +- py/src/braintrust/logger.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/js/src/logger.ts b/js/src/logger.ts index 17a44daa..7368e46e 100644 --- a/js/src/logger.ts +++ b/js/src/logger.ts @@ -1093,7 +1093,7 @@ type InitializedExperiment = * * @param options Options for configuring init(). * @param options.project The name of the project to create the experiment in. Must specify at least one of `project` or `projectId`. - * @param options.experiment The name of the experiment to create. If not specified, a name will be generated automatically. If you use an existing experiment name, by default it will create a new experiment with that name as a prefix. If you want to update an existing experiment, you can set `update=True`. If you want to open an existing experiment in read-only mode, you can set `open=True`. + * @param options.experiment The name of the experiment to create. If not specified, a name will be generated automatically. If you use an existing experiment name, by default it will create a new experiment with that name as a prefix. If you want to update an existing experiment, you can set `options.update: true`. If you want to open an existing experiment in read-only mode, you can set `options.open: true`. * @param options.description An optional description of the experiment. * @param options.dataset (Optional) A dataset to associate with the experiment. You can pass in the name of the dataset (in the same project) or a dataset object (from any project). * @param options.update If the experiment already exists, continue logging to it. diff --git a/py/src/braintrust/logger.py b/py/src/braintrust/logger.py index 6a0c355b..1e405ac0 100644 --- a/py/src/braintrust/logger.py +++ b/py/src/braintrust/logger.py @@ -678,7 +678,7 @@ def init( Log in, and then initialize a new experiment in a specified project. If the project does not exist, it will be created. :param project: The name of the project to create the experiment in. Must specify at least one of `project` or `project_id`. - :param experiment: The name of the experiment to create. If not specified, a name will be generated automatically. + :param experiment: The name of the experiment to create. If not specified, a name will be generated automatically. If you use an existing experiment name, by default it will create a new experiment with that name as a prefix. If you want to update an existing experiment, you can set `update=True`. If you want to open an existing experiment in read-only mode, you can set `open=True`. :param description: (Optional) An optional description of the experiment. :param dataset: (Optional) A dataset to associate with the experiment. The dataset must be initialized with `braintrust.init_dataset` before passing it into the experiment. @@ -2430,9 +2430,11 @@ def build(self, **build_args): ret["messages"] = [ { **{k: v for (k, v) in m.as_dict().items() if v is not None}, - "content": chevron.render(m.content, data=build_args) - if isinstance(m.content, str) - else json.loads(chevron.render(json.dumps(m.content), data=build_args)), + "content": ( + chevron.render(m.content, data=build_args) + if isinstance(m.content, str) + else json.loads(chevron.render(json.dumps(m.content), data=build_args)) + ), } for m in self.prompt.messages ] From 97deb0f6de29e941f06583e03ebab6a4b49bdb43 Mon Sep 17 00:00:00 2001 From: Robert Guss Date: Wed, 17 Apr 2024 14:50:16 -0400 Subject: [PATCH 3/3] revert auto formatting --- py/src/braintrust/logger.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/py/src/braintrust/logger.py b/py/src/braintrust/logger.py index 1e405ac0..03e4ea26 100644 --- a/py/src/braintrust/logger.py +++ b/py/src/braintrust/logger.py @@ -2430,11 +2430,9 @@ def build(self, **build_args): ret["messages"] = [ { **{k: v for (k, v) in m.as_dict().items() if v is not None}, - "content": ( - chevron.render(m.content, data=build_args) - if isinstance(m.content, str) - else json.loads(chevron.render(json.dumps(m.content), data=build_args)) - ), + "content": chevron.render(m.content, data=build_args) + if isinstance(m.content, str) + else json.loads(chevron.render(json.dumps(m.content), data=build_args)), } for m in self.prompt.messages ]