Skip to content

Commit f8f3e03

Browse files
committed
fix: docstrings
1 parent a02b2e8 commit f8f3e03

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

mellea/stdlib/funcs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,12 @@ def transform(
347347
"""Transform method for creating a new object with the transformation applied.
348348
349349
Args:
350-
obj : The object to be queried. It should be an instance of MObject or can be converted to one if necessary.
350+
obj: The object to be queried. It should be an instance of MObject or can be converted to one if necessary.
351351
transformation: The string representing the query to be executed against the object.
352352
context: the context being used as a history from which to generate the response.
353353
backend: the backend used to generate the response.
354+
format: format for output parsing; usually not needed with transform.
355+
model_options: Model options to pass to the backend.
354356
355357
Returns:
356358
(ModelOutputThunk | Any, Context): The result of the transformation as processed by the backend. If no tools were called,
@@ -476,7 +478,6 @@ async def aact(
476478
Returns:
477479
A (ModelOutputThunk, Context) if `return_sampling_results` is `False`, else returns a `SamplingResult`.
478480
"""
479-
480481
if not silence_context_type_warning and not isinstance(context, SimpleContext):
481482
FancyLogger().get_logger().warning(
482483
"Not using a SimpleContext with asynchronous requests could cause unexpected results due to stale contexts. Ensure you await between requests."
@@ -630,7 +631,6 @@ async def ainstruct(
630631
Returns:
631632
A (ModelOutputThunk, Context) if `return_sampling_results` is `False`, else returns a `SamplingResult`.
632633
"""
633-
634634
requirements = [] if requirements is None else requirements
635635
icl_examples = [] if icl_examples is None else icl_examples
636636
grounding_context = dict() if grounding_context is None else grounding_context

mellea/stdlib/session.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
196196
self._context_token = None
197197

198198
def __copy__(self):
199+
"""Use self.clone. Copies the current session but keeps references to the backend and context."""
199200
new = MelleaSession(backend=self.backend, ctx=self.ctx)
200201
new._session_logger = self._session_logger
201202
# Explicitly don't copy over the _context_token.
@@ -206,7 +207,7 @@ def clone(self):
206207
"""Useful for running multiple generation requests while keeping the context at a given point in time.
207208
208209
Returns:
209-
a copy of the current session. Keeps the context, backend, backend stack, and session logger.
210+
a copy of the current session. Keeps the context, backend, and session logger.
210211
211212
Examples:
212213
>>> from mellea import start_session
@@ -286,7 +287,6 @@ def act(
286287
Returns:
287288
A ModelOutputThunk if `return_sampling_results` is `False`, else returns a `SamplingResult`.
288289
"""
289-
290290
r = mfuncs.act(
291291
action,
292292
context=self.ctx,
@@ -571,7 +571,6 @@ async def aact(
571571
Returns:
572572
A ModelOutputThunk if `return_sampling_results` is `False`, else returns a `SamplingResult`.
573573
"""
574-
575574
r = await mfuncs.aact(
576575
action,
577576
context=self.ctx,
@@ -664,7 +663,6 @@ async def ainstruct(
664663
tool_calls: If true, tool calling is enabled.
665664
images: A list of images to be used in the instruction or None if none.
666665
"""
667-
668666
r = await mfuncs.ainstruct(
669667
description,
670668
context=self.ctx,
@@ -704,7 +702,6 @@ async def achat(
704702
tool_calls: bool = False,
705703
) -> Message:
706704
"""Sends a simple chat message and returns the response. Adds both messages to the Context."""
707-
708705
result, context = await mfuncs.achat(
709706
content=content,
710707
context=self.ctx,
@@ -731,7 +728,6 @@ async def avalidate(
731728
input: CBlock | None = None,
732729
) -> list[ValidationResult]:
733730
"""Validates a set of requirements over the output (if provided) or the current context (if the output is not provided)."""
734-
735731
return await mfuncs.avalidate(
736732
reqs=reqs,
737733
context=self.ctx,
@@ -787,8 +783,10 @@ async def atransform(
787783
"""Transform method for creating a new object with the transformation applied.
788784
789785
Args:
790-
obj : The object to be queried. It should be an instance of MObject or can be converted to one if necessary.
786+
obj: The object to be queried. It should be an instance of MObject or can be converted to one if necessary.
791787
transformation: The string representing the query to be executed against the object.
788+
format: format for output parsing; usually not needed with transform.
789+
model_options: Model options to pass to the backend.
792790
793791
Returns:
794792
ModelOutputThunk|Any: The result of the transformation as processed by the backend. If no tools were called,

0 commit comments

Comments
 (0)