Skip to content

Commit

Permalink
x/fix python sdk (#296)
Browse files Browse the repository at this point in the history
* fix: Minor fixes to python sdk

Signed-off-by: Diwank Singh Tomer <[email protected]>

* version(sdks/python): 0.2.14

Signed-off-by: Diwank Singh Tomer <[email protected]>

* deps(agents-api): Update poetry.lock

Signed-off-by: Diwank Singh Tomer <[email protected]>

---------

Signed-off-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
creatorrr authored Apr 26, 2024
1 parent 473f6db commit 0830a1f
Show file tree
Hide file tree
Showing 15 changed files with 246 additions and 187 deletions.
54 changes: 27 additions & 27 deletions agents-api/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion agents-api/pytype.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ inputs = [
]

# Keep going past errors to analyze as many files as possible.
keep_going = true
keep_going = false

# Run N jobs in parallel. When 'auto' is used, this will be equivalent to the
# number of CPUs on the host system.
Expand Down
31 changes: 31 additions & 0 deletions docs/merge-manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# For use with `merge-markdown`
---
input:
./SUMMARY.md: ""
./README.md: ""
./README (1).md: ""
./introduction/core-concepts.md: ""
./introduction/julep-in-a-nutshell.md: ""
./getting-started/agents-quickstart.md: ""
./getting-started/python-setup.md: ""
./agents/jessica.md: ""
./agents/overview.md: ""
./agents/self-hosting.md: ""
./agents/tutorial.md: ""
./faqs/agent-prototyping.md: ""
./faqs/general-overview.md: ""
./faqs/memory-and-learning.md: ""
./faqs/README.md: ""
./faqs/sessions-and-tasks.md: ""
./faqs/technical-details.md: ""
./api-reference/agents-api/agents-api-1.md: ""
./api-reference/agents-api/agents-api-2.md: ""
./api-reference/agents-api/agents-api-3.md: ""
./api-reference/agents-api/agents-api-4.md: ""
./api-reference/agents-api/agents-api-5.md: ""
./api-reference/agents-api/agents-api-6.md: ""
./api-reference/agents-api/agents-api.md: ""
./api-reference/agents-api/README.md: ""
output:
name: merged/doc.md
---
4 changes: 2 additions & 2 deletions sdks/python/julep/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ def chat(
if min_p is not OMIT:
_request["min_p"] = min_p
if preset is not OMIT:
_request["preset"] = preset.value
_request["preset"] = preset.value # type: ignore
if recall is not OMIT:
_request["recall"] = recall
if record is not OMIT:
Expand Down Expand Up @@ -2596,7 +2596,7 @@ async def chat(
if min_p is not OMIT:
_request["min_p"] = min_p
if preset is not OMIT:
_request["preset"] = preset.value
_request["preset"] = preset.value # type: ignore
if recall is not OMIT:
_request["recall"] = recall
if record is not OMIT:
Expand Down
5 changes: 5 additions & 0 deletions sdks/python/julep/api/types/agent_instructions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was auto-generated by Fern from our API Definition.

import typing

AgentInstructions = typing.Union[str, typing.List[str]]
1 change: 0 additions & 1 deletion sdks/python/julep/api/types/chat_input_data_tool_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import typing

from .named_tool_choice import NamedToolChoice
from .named_tool_choice_function import NamedToolChoiceFunction
from .tool_choice_option import ToolChoiceOption

ChatInputDataToolChoice = typing.Union[ToolChoiceOption, NamedToolChoice]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was auto-generated by Fern from our API Definition.

import typing

CreateAgentRequestInstructions = typing.Union[str, typing.List[str]]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was auto-generated by Fern from our API Definition.

import typing

PatchAgentRequestInstructions = typing.Union[str, typing.List[str]]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was auto-generated by Fern from our API Definition.

import typing

UpdateAgentRequestInstructions = typing.Union[str, typing.List[str]]
13 changes: 8 additions & 5 deletions sdks/python/julep/managers/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
CreateDoc,
Doc,
ResourceCreatedResponse,
ResourceDeletedResponse,
GetAgentDocsResponse,
)

Expand Down Expand Up @@ -165,7 +166,7 @@ def _delete(
agent_id: Optional[Union[str, UUID]],
user_id: Optional[Union[str, UUID]],
doc_id: Union[str, UUID],
):
) -> Union[ResourceDeletedResponse, Awaitable[ResourceDeletedResponse]]:
"""
Delete docs based on either an agent_id or a user_id.
Expand All @@ -183,10 +184,12 @@ def _delete(
AssertionError: If both `agent_id` and `user_id` are provided, neither are provided, or if the provided IDs are not valid UUID v4 strings.
Other exceptions related to the `api_client` operations could potentially be raised and depend on its implementation.
"""
assert (
(agent_id and is_valid_uuid4(agent_id))
or (user_id and is_valid_uuid4(user_id))
and not (agent_id and user_id)
assert bool(agent_id) ^ bool(
user_id
), "One and only one of user_id or agent_id must be given."

assert (agent_id and is_valid_uuid4(agent_id)) or (
user_id and is_valid_uuid4(user_id)
), "One and only one of user_id or agent_id must be given and must be valid UUID v4"

if agent_id is not None:
Expand Down
5 changes: 3 additions & 2 deletions sdks/python/julep/managers/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from ..api.types import (
ResourceCreatedResponse,
ResourceDeletedResponse,
FunctionDef,
GetAgentToolsResponse,
CreateToolRequest,
Expand Down Expand Up @@ -142,7 +143,7 @@ def _delete(
self,
agent_id: Union[str, UUID],
tool_id: Union[str, UUID],
):
) -> Union[ResourceDeletedResponse, Awaitable[ResourceDeletedResponse]]:
"""
Delete a tool associated with an agent.
Expand Down Expand Up @@ -432,7 +433,7 @@ async def delete(
*,
agent_id: Union[str, UUID],
tool_id: Union[str, UUID],
):
) -> Awaitable[ResourceDeletedResponse]:
"""
Asynchronously delete a specified agent-tool association.
Expand Down
Loading

0 comments on commit 0830a1f

Please sign in to comment.