Fix SDK client (#5214)
parent
4bb86c0cb5
commit
6342a77037
|
@ -46,7 +46,7 @@ async def run_api_agent(
|
|||
)
|
||||
|
||||
artifacts = await api_instance.list_agent_task_artifacts(task_id=task_id)
|
||||
for artifact in artifacts:
|
||||
for artifact in artifacts.artifacts:
|
||||
# current absolute path of the directory of the file
|
||||
directory_location = TEMP_FOLDER_ABS_PATH
|
||||
if artifact.relative_path:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
import io
|
||||
import re # noqa: F401
|
||||
import warnings
|
||||
from typing import Awaitable, List, Optional, Union, overload
|
||||
from typing import Awaitable, List, Optional, Union, overload, Any
|
||||
|
||||
from pydantic import Field, StrictBytes, StrictStr, ValidationError, validate_arguments
|
||||
from typing_extensions import Annotated
|
||||
|
@ -936,7 +936,7 @@ class AgentApi(object):
|
|||
self,
|
||||
task_id: Annotated[StrictStr, Field(..., description="ID of the task")],
|
||||
**kwargs,
|
||||
) -> List[Artifact]: # noqa: E501
|
||||
) -> Any: # noqa: E501
|
||||
...
|
||||
|
||||
@overload
|
||||
|
@ -945,7 +945,7 @@ class AgentApi(object):
|
|||
task_id: Annotated[StrictStr, Field(..., description="ID of the task")],
|
||||
async_req: Optional[bool] = True,
|
||||
**kwargs,
|
||||
) -> List[Artifact]: # noqa: E501
|
||||
) -> Any: # noqa: E501
|
||||
...
|
||||
|
||||
@validate_arguments
|
||||
|
@ -954,7 +954,7 @@ class AgentApi(object):
|
|||
task_id: Annotated[StrictStr, Field(..., description="ID of the task")],
|
||||
async_req: Optional[bool] = None,
|
||||
**kwargs,
|
||||
) -> Union[List[Artifact], Awaitable[List[Artifact]]]: # noqa: E501
|
||||
) -> Union[Any, Awaitable[Any]]: # noqa: E501
|
||||
"""List all artifacts that have been created for the given task. # noqa: E501
|
||||
|
||||
This method makes a synchronous HTTP request by default. To make an
|
||||
|
@ -1078,7 +1078,7 @@ class AgentApi(object):
|
|||
_auth_settings = [] # noqa: E501
|
||||
|
||||
_response_types_map = {
|
||||
"200": "List[Artifact]",
|
||||
"200": "Artifacts",
|
||||
}
|
||||
|
||||
return self.api_client.call_api(
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
|
||||
# import models into model package
|
||||
from agent_protocol_client.models.artifact import Artifact
|
||||
from agent_protocol_client.models.artifacts import Artifacts
|
||||
from agent_protocol_client.models.pagination import Pagination
|
||||
|
||||
from agent_protocol_client.models.step import Step
|
||||
from agent_protocol_client.models.step_all_of import StepAllOf
|
||||
from agent_protocol_client.models.step_request_body import StepRequestBody
|
||||
|
|
|
@ -33,6 +33,9 @@ class Artifact(BaseModel):
|
|||
None, description="Relative path of the artifact in the agent's workspace."
|
||||
)
|
||||
__properties = ["artifact_id", "file_name", "relative_path"]
|
||||
created_at: StrictStr = Field(..., description="Creation date of the artifact.")
|
||||
# modified_at: StrictStr = Field(..., description="Modification date of the artifact.")
|
||||
agent_created: bool = Field( ..., description="True if created by the agent")
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
|
@ -72,6 +75,9 @@ class Artifact(BaseModel):
|
|||
"artifact_id": obj.get("artifact_id"),
|
||||
"file_name": obj.get("file_name"),
|
||||
"relative_path": obj.get("relative_path"),
|
||||
"created_at": obj.get("created_at"),
|
||||
"modifed_at": obj.get("modifed_at"),
|
||||
"agent_created": obj.get("agent_created"),
|
||||
}
|
||||
)
|
||||
return _obj
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Agent Communication Protocol
|
||||
|
||||
Specification of the API protocol for communication with an agent. # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: v0.2
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, Field, StrictStr
|
||||
from agent_protocol_client.models.artifact import Artifact
|
||||
|
||||
from agent_protocol_client.models.pagination import Pagination
|
||||
|
||||
class Artifacts(BaseModel):
|
||||
"""
|
||||
Artifacts that the task has produced.
|
||||
"""
|
||||
|
||||
artifacts: list[Artifact]
|
||||
pagination: Pagination
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Artifacts:
|
||||
"""Create an instance of Artifacts from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> Artifacts:
|
||||
"""Create an instance of Artifacts from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return Artifacts.parse_obj(obj)
|
||||
|
||||
_obj = Artifacts.parse_obj(
|
||||
{
|
||||
"artifacts": obj.get("artifacts"),
|
||||
"pagination": obj.get("pagination"),
|
||||
}
|
||||
)
|
||||
return _obj
|
||||
|
||||
Artifacts.update_forward_refs()
|
|
@ -0,0 +1,76 @@
|
|||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Agent Communication Protocol
|
||||
|
||||
Specification of the API protocol for communication with an agent. # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: v0.2
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, Field, StrictStr
|
||||
|
||||
|
||||
class Pagination(BaseModel):
|
||||
"""
|
||||
Pagination that the task has produced.
|
||||
"""
|
||||
total_items: int
|
||||
total_pages: int
|
||||
current_page: int
|
||||
page_size: int
|
||||
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Pagination:
|
||||
"""Create an instance of Pagination from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> Pagination:
|
||||
"""Create an instance of Pagination from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return Pagination.parse_obj(obj)
|
||||
|
||||
_obj = Pagination.parse_obj(
|
||||
{
|
||||
"total_items": obj.get("total_items"),
|
||||
"total_pages": obj.get("total_pages"),
|
||||
"current_page": obj.get("current_page"),
|
||||
"page_size": obj.get("page_size"),
|
||||
}
|
||||
)
|
||||
return _obj
|
Loading…
Reference in New Issue