Skip to content

Commit 167483b

Browse files
authored
Merge branch 'main' into main
2 parents 99bbe04 + dc610ae commit 167483b

File tree

11 files changed

+2982
-2722
lines changed

11 files changed

+2982
-2722
lines changed

.github/mergify.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
merge_protections:
2+
- name: Enforce conventional commit
3+
description: Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
4+
if:
5+
- base = main
6+
success_conditions:
7+
- "title ~=
8+
^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\\(.+\
9+
\\))?:"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pip install mellea
6060
```
6161

6262
> [!NOTE]
63-
> `mellea` comes with some additional packages as defined in our `pyproject.toml`. I you would like to install all the extra optional dependencies, please run the following commands:
63+
> `mellea` comes with some additional packages as defined in our `pyproject.toml`. If you would like to install all the extra optional dependencies, please run the following commands:
6464
>
6565
> ```bash
6666
> uv pip install mellea[hf] # for Huggingface extras and Alora capabilities.

mellea/stdlib/genslot.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pydantic import BaseModel, Field, create_model
1010

1111
from mellea.stdlib.base import Component, TemplateRepresentation
12-
from mellea.stdlib.session import get_session
12+
from mellea.stdlib.session import MelleaSession, get_session
1313

1414
P = ParamSpec("P")
1515
R = TypeVar("R")
@@ -154,7 +154,7 @@ def __init__(self, func: Callable[P, R]):
154154

155155
def __call__(
156156
self,
157-
m=None,
157+
m: MelleaSession | None = None,
158158
model_options: dict | None = None,
159159
*args: P.args,
160160
**kwargs: P.kwargs,
@@ -180,13 +180,11 @@ def __call__(
180180

181181
response_model = create_response_format(self._function._func)
182182

183-
response = m.genslot(
184-
slot_copy, model_options=model_options, format=response_model
185-
)
183+
response = m.act(slot_copy, format=response_model, model_options=model_options)
186184

187185
function_response: FunctionResponse[R] = response_model.model_validate_json(
188-
response.value
189-
) # type: ignore
186+
response.value # type: ignore
187+
)
190188

191189
return function_response.result
192190

mellea/stdlib/instruction.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Instructions."""
22

3+
from __future__ import annotations
4+
35
from copy import deepcopy
46

57
import jinja2
@@ -106,6 +108,7 @@ def __init__(
106108
self._output_prefix = (
107109
blockify(output_prefix) if output_prefix is not None else None
108110
)
111+
self._repair_string: str | None = None
109112

110113
def parts(self):
111114
"""Returns all of the constituent parts of an Instruction."""
@@ -132,6 +135,7 @@ def format_for_llm(self) -> TemplateRepresentation:
132135
"output_prefix": (
133136
self._output_prefix if self._output_prefix is not None else None
134137
),
138+
"repair": self._repair_string,
135139
},
136140
tools=None,
137141
template_order=["*", "Instruction"],
@@ -147,3 +151,9 @@ def apply_user_dict_from_jinja(user_dict: dict[str, str], s: str) -> str:
147151
def requirements(self) -> list[Requirement]:
148152
"""Returns a list of Requirement instances."""
149153
return self._requirements
154+
155+
def copy_and_repair(self, repair_string: str) -> Instruction:
156+
"""Creates a copy of the instruction and adds/overwrites the repair string."""
157+
res = deepcopy(self)
158+
res._repair_string = repair_string
159+
return res

0 commit comments

Comments
 (0)