Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/parea-ai/parea-sdk into doc…
Browse files Browse the repository at this point in the history
…s-readme-update
  • Loading branch information
joschkabraun committed Jul 1, 2024
2 parents 30b4b2a + 30b6435 commit cafe56d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions parea/wrapper/anthropic/anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@

from parea.cache.cache import Cache
from parea.helpers import timezone_aware_now
from parea.schemas import CacheRequest, LLMInputs, ModelParams, TraceLog
from parea.schemas import CacheRequest, LLMInputs
from parea.schemas import ModelParams
from parea.schemas import Role as PareaRole
from parea.schemas import TraceLog
from parea.utils.trace_utils import make_output, trace_data
from parea.wrapper import Wrapper
from parea.wrapper.anthropic.stream_wrapper import AnthropicAsyncStreamWrapper, AnthropicStreamWrapper, MessageAsyncStreamManagerWrapper, MessageStreamManagerWrapper
Expand Down Expand Up @@ -126,13 +129,19 @@ def _get_default_dict_streaming():
@staticmethod
def _kwargs_to_llm_configuration(kwargs, model=None) -> LLMInputs:
functions = deepcopy([d for d in kwargs.get("tools", [])])
messages = kwargs.get("messages", None)
if system_msg := kwargs.get("system", None):
if not messages:
messages = []
messages = messages.copy()
messages.insert(0, dict(role=PareaRole.system, content=system_msg))
for func in functions:
if "input_schema" in func:
func["parameters"] = func.pop("input_schema")
return LLMInputs(
model=model or kwargs.get("model", None),
provider="anthropic",
messages=kwargs.get("messages", None),
messages=messages,
model_params=ModelParams(
temp=kwargs.get("temperature", 1.0),
max_length=kwargs.get("max_tokens", None),
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.180"
version = "0.2.181"
description = "Parea python sdk"
readme = "README.md"
authors = ["joel-parea-ai <[email protected]>"]
Expand Down

0 comments on commit cafe56d

Please sign in to comment.