Skip to content

Commit

Permalink
Merge pull request #833 from parea-ai/PAI-967-support-anthropic-tool-…
Browse files Browse the repository at this point in the history
…result-field-in-python

fix: deepcopy anthropic functions
  • Loading branch information
joschkabraun committed May 2, 2024
2 parents 5fdc7fa + 4432b3b commit ee75a66
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion parea/cookbook/tracing_anthropic_tool_use.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
client = anthropic.Anthropic()
aclient = anthropic.AsyncAnthropic()

p = Parea(api_key=os.getenv("PAREA_API_KEY"), project_name="testing")
p = Parea(api_key=os.getenv("PAREA_API_KEY"))
p.wrap_anthropic_client(client)
p.wrap_anthropic_client(aclient)

Expand Down
3 changes: 2 additions & 1 deletion parea/wrapper/anthropic/anthropic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Any, Callable, Dict, Optional, Sequence

from collections import defaultdict
from copy import deepcopy
from datetime import datetime

from anthropic import AsyncMessageStreamManager, AsyncStream, Client, MessageStreamManager, Stream
Expand Down Expand Up @@ -123,7 +124,7 @@ def _get_default_dict_streaming():

@staticmethod
def _kwargs_to_llm_configuration(kwargs, model=None) -> LLMInputs:
functions = [d for d in kwargs.get("tools", [])]
functions = deepcopy([d for d in kwargs.get("tools", [])])
for func in functions:
if "input_schema" in func:
func["parameters"] = func.pop("input_schema")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "parea-ai"
packages = [{ include = "parea" }]
version = "0.2.146"
version = "0.2.147"
description = "Parea python sdk"
readme = "README.md"
authors = ["joel-parea-ai <[email protected]>"]
Expand Down

0 comments on commit ee75a66

Please sign in to comment.