Skip to content

Commit b3e0e86

Browse files
committed
fixes #85
1 parent 73f8dfe commit b3e0e86

File tree

7 files changed

+316
-416
lines changed

7 files changed

+316
-416
lines changed

00_core.ipynb

Lines changed: 141 additions & 196 deletions
Large diffs are not rendered by default.

01_toolloop.ipynb

Lines changed: 120 additions & 153 deletions
Large diffs are not rendered by default.

02_async.ipynb

Lines changed: 50 additions & 54 deletions
Large diffs are not rendered by default.

claudette/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.2.3"
1+
__version__ = "0.3.0"
22
from .core import *
33
from .toolloop import *
44
from .asink import *

claudette/asink.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,12 @@ async def mk_funcres_async(fc, ns):
7070
# %% ../02_async.ipynb
7171
async def mk_toolres_async(
7272
r:abc.Mapping, # Tool use request response from Claude
73-
ns:Optional[abc.Mapping]=None, # Namespace to search for tools
74-
obj:Optional=None # Class to search for tools
73+
ns:Optional[abc.Mapping]=None # Namespace to search for tools
7574
):
7675
"Create a `tool_result` message from response `r`."
7776
cts = getattr(r, 'content', [])
7877
res = [mk_msg(r.model_dump(), role='assistant')]
7978
if ns is None: ns=globals()
80-
if obj is not None: ns = mk_ns(obj)
8179
tcs = [await mk_funcres_async(o, ns) for o in cts if isinstance(o,ToolUseBlock)]
8280
if tcs: res.append(mk_msg(tcs))
8381
return res
@@ -88,13 +86,11 @@ async def mk_toolres_async(
8886
async def structured(self:AsyncClient,
8987
msgs:list, # List of messages in the dialog
9088
tools:Optional[list]=None, # List of tools to make available to Claude
91-
obj:Optional=None, # Class to search for tools
9289
ns:Optional[abc.Mapping]=None, # Namespace to search for tools
9390
**kwargs):
9491
"Return the value of all tool calls (generally used for structured outputs)"
9592
tools = listify(tools)
9693
if ns is None: ns=mk_ns(*tools)
97-
if obj is not None: ns = mk_ns(obj)
9894
res = await self(msgs, tools=tools, tool_choice=tools,**kwargs)
9995
cts = getattr(res, 'content', [])
10096
tcs = [await call_func_async(o.name, o.input, ns=ns) for o in cts if isinstance(o,ToolUseBlock)]

claudette/core.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,12 @@ def mk_funcres(fc, ns):
341341
# %% ../00_core.ipynb
342342
def mk_toolres(
343343
r:abc.Mapping, # Tool use request response from Claude
344-
ns:Optional[abc.Mapping]=None, # Namespace to search for tools
345-
obj:Optional=None # Class to search for tools
344+
ns:Optional[abc.Mapping]=None # Namespace to search for tools
346345
):
347346
"Create a `tool_result` message from response `r`."
348347
cts = getattr(r, 'content', [])
349348
res = [mk_msg(r.model_dump(), role='assistant')]
350349
if ns is None: ns=globals()
351-
if obj is not None: ns = mk_ns(obj)
352350
tcs = [mk_funcres(o, ns) for o in cts if isinstance(o,ToolUseBlock)]
353351
if tcs: res.append(mk_msg(tcs))
354352
return res
@@ -359,14 +357,12 @@ def mk_toolres(
359357
def structured(self:Client,
360358
msgs:list, # List of messages in the dialog
361359
tools:Optional[list]=None, # List of tools to make available to Claude
362-
obj:Optional=None, # Class to search for tools
363360
ns:Optional[abc.Mapping]=None, # Namespace to search for tools
364361
**kwargs):
365362
"Return the value of all tool calls (generally used for structured outputs)"
366363
tools = listify(tools)
367364
res = self(msgs, tools=tools, tool_choice=tools, **kwargs)
368365
if ns is None: ns=mk_ns(*tools)
369-
if obj is not None: ns = mk_ns(obj)
370366
cts = getattr(res, 'content', [])
371367
tcs = [call_func(o.name, o.input, ns=ns) for o in cts if isinstance(o,ToolUseBlock)]
372368
return tcs

settings.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[DEFAULT]
22
repo = claudette
33
lib_name = claudette
4-
version = 0.2.3
4+
version = 0.3.0
55
min_python = 3.9
66
license = apache2
77
black_formatting = False
8-
requirements = fastcore>=1.8.4 msglm>=0.0.8 anthropic>=0.52 toolslm>=0.2.3
8+
requirements = fastcore>=1.8.4 msglm>=0.0.8 anthropic>=0.52 toolslm>=0.3.0
99
dev_requirements = google-auth
1010
doc_path = _docs
1111
lib_path = claudette

0 commit comments

Comments
 (0)