Skip to content

Commit 6ff7e05

Browse files
authored
simplify import paths; Sync updates from stainless branch: ehhuang/dev (#205)
# What does this PR do? synced stainless and move some classes to the top level llama_stack_client module ## Test Plan test_agents.py and run examples [//]: # (## Documentation) [//]: # (- [ ] Added a Changelog entry if the change is significant)
1 parent 4bab07a commit 6ff7e05

26 files changed

+152
-149
lines changed

src/llama_stack_client/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
3838
from ._utils._logs import setup_logging as _setup_logging
3939

40+
from .lib.agents.agent import Agent
41+
from .lib.agents.event_logger import EventLogger as AgentEventLogger
42+
from .lib.inference.event_logger import EventLogger as InferenceEventLogger
43+
from .types.agents.turn_create_params import Document
44+
from .types.shared_params.document import Document as RAGDocument
45+
4046
__all__ = [
4147
"types",
4248
"__version__",

src/llama_stack_client/resources/benchmarks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, List, Type, Union, Iterable, Optional, cast
5+
from typing import Dict, List, Type, Union, Iterable, cast
66

77
import httpx
88

@@ -58,7 +58,7 @@ def retrieve(
5858
extra_query: Query | None = None,
5959
extra_body: Body | None = None,
6060
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
61-
) -> Optional[Benchmark]:
61+
) -> Benchmark:
6262
"""
6363
Args:
6464
extra_headers: Send extra headers
@@ -178,7 +178,7 @@ async def retrieve(
178178
extra_query: Query | None = None,
179179
extra_body: Body | None = None,
180180
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
181-
) -> Optional[Benchmark]:
181+
) -> Benchmark:
182182
"""
183183
Args:
184184
extra_headers: Send extra headers

src/llama_stack_client/resources/datasets.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, Type, Union, Iterable, Optional, cast
5+
from typing import Dict, Type, Union, Iterable, cast
66
from typing_extensions import Literal
77

88
import httpx
@@ -61,7 +61,7 @@ def retrieve(
6161
extra_query: Query | None = None,
6262
extra_body: Body | None = None,
6363
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
64-
) -> Optional[DatasetRetrieveResponse]:
64+
) -> DatasetRetrieveResponse:
6565
"""
6666
Args:
6767
extra_headers: Send extra headers
@@ -286,7 +286,7 @@ async def retrieve(
286286
extra_query: Query | None = None,
287287
extra_body: Body | None = None,
288288
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
289-
) -> Optional[DatasetRetrieveResponse]:
289+
) -> DatasetRetrieveResponse:
290290
"""
291291
Args:
292292
extra_headers: Send extra headers

src/llama_stack_client/resources/eval/jobs.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
6-
75
import httpx
86

97
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
@@ -126,7 +124,7 @@ def status(
126124
extra_query: Query | None = None,
127125
extra_body: Body | None = None,
128126
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
129-
) -> Optional[JobStatusResponse]:
127+
) -> JobStatusResponse:
130128
"""
131129
Get the status of a job.
132130
@@ -256,7 +254,7 @@ async def status(
256254
extra_query: Query | None = None,
257255
extra_body: Body | None = None,
258256
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
259-
) -> Optional[JobStatusResponse]:
257+
) -> JobStatusResponse:
260258
"""
261259
Get the status of a job.
262260

src/llama_stack_client/resources/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, Type, Union, Iterable, Optional, cast
5+
from typing import Dict, Type, Union, Iterable, cast
66
from typing_extensions import Literal
77

88
import httpx
@@ -59,7 +59,7 @@ def retrieve(
5959
extra_query: Query | None = None,
6060
extra_body: Body | None = None,
6161
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
62-
) -> Optional[Model]:
62+
) -> Model:
6363
"""
6464
Args:
6565
extra_headers: Send extra headers
@@ -208,7 +208,7 @@ async def retrieve(
208208
extra_query: Query | None = None,
209209
extra_body: Body | None = None,
210210
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
211-
) -> Optional[Model]:
211+
) -> Model:
212212
"""
213213
Args:
214214
extra_headers: Send extra headers

src/llama_stack_client/resources/post_training/job.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Type, Optional, cast
5+
from typing import List, Type, cast
66

77
import httpx
88

@@ -81,7 +81,7 @@ def artifacts(
8181
extra_query: Query | None = None,
8282
extra_body: Body | None = None,
8383
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
84-
) -> Optional[JobArtifactsResponse]:
84+
) -> JobArtifactsResponse:
8585
"""
8686
Args:
8787
extra_headers: Send extra headers
@@ -145,7 +145,7 @@ def status(
145145
extra_query: Query | None = None,
146146
extra_body: Body | None = None,
147147
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
148-
) -> Optional[JobStatusResponse]:
148+
) -> JobStatusResponse:
149149
"""
150150
Args:
151151
extra_headers: Send extra headers
@@ -221,7 +221,7 @@ async def artifacts(
221221
extra_query: Query | None = None,
222222
extra_body: Body | None = None,
223223
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
224-
) -> Optional[JobArtifactsResponse]:
224+
) -> JobArtifactsResponse:
225225
"""
226226
Args:
227227
extra_headers: Send extra headers
@@ -285,7 +285,7 @@ async def status(
285285
extra_query: Query | None = None,
286286
extra_body: Body | None = None,
287287
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
288-
) -> Optional[JobStatusResponse]:
288+
) -> JobStatusResponse:
289289
"""
290290
Args:
291291
extra_headers: Send extra headers

src/llama_stack_client/resources/post_training/post_training.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
JobResourceWithStreamingResponse,
1515
AsyncJobResourceWithStreamingResponse,
1616
)
17-
from ...types import (
18-
post_training_preference_optimize_params,
19-
post_training_supervised_fine_tune_params,
20-
)
17+
from ...types import post_training_preference_optimize_params, post_training_supervised_fine_tune_params
2118
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
2219
from ..._utils import (
2320
maybe_transform,
@@ -33,7 +30,6 @@
3330
)
3431
from ..._base_client import make_request_options
3532
from ...types.post_training_job import PostTrainingJob
36-
from ...types.algorithm_config_param import AlgorithmConfigParam
3733

3834
__all__ = ["PostTrainingResource", "AsyncPostTrainingResource"]
3935

@@ -115,7 +111,7 @@ def supervised_fine_tune(
115111
logger_config: Dict[str, Union[bool, float, str, Iterable[object], object, None]],
116112
model: str,
117113
training_config: post_training_supervised_fine_tune_params.TrainingConfig,
118-
algorithm_config: AlgorithmConfigParam | NotGiven = NOT_GIVEN,
114+
algorithm_config: post_training_supervised_fine_tune_params.AlgorithmConfig | NotGiven = NOT_GIVEN,
119115
checkpoint_dir: str | NotGiven = NOT_GIVEN,
120116
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
121117
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -232,7 +228,7 @@ async def supervised_fine_tune(
232228
logger_config: Dict[str, Union[bool, float, str, Iterable[object], object, None]],
233229
model: str,
234230
training_config: post_training_supervised_fine_tune_params.TrainingConfig,
235-
algorithm_config: AlgorithmConfigParam | NotGiven = NOT_GIVEN,
231+
algorithm_config: post_training_supervised_fine_tune_params.AlgorithmConfig | NotGiven = NOT_GIVEN,
236232
checkpoint_dir: str | NotGiven = NOT_GIVEN,
237233
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
238234
# The extra values given here take precedence over values defined on the client or passed to this method.

src/llama_stack_client/resources/scoring_functions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Type, Optional, cast
5+
from typing import Type, cast
66

77
import httpx
88

@@ -60,7 +60,7 @@ def retrieve(
6060
extra_query: Query | None = None,
6161
extra_body: Body | None = None,
6262
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
63-
) -> Optional[ScoringFn]:
63+
) -> ScoringFn:
6464
"""
6565
Args:
6666
extra_headers: Send extra headers
@@ -180,7 +180,7 @@ async def retrieve(
180180
extra_query: Query | None = None,
181181
extra_body: Body | None = None,
182182
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
183-
) -> Optional[ScoringFn]:
183+
) -> ScoringFn:
184184
"""
185185
Args:
186186
extra_headers: Send extra headers

src/llama_stack_client/resources/shields.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, Type, Union, Iterable, Optional, cast
5+
from typing import Dict, Type, Union, Iterable, cast
66

77
import httpx
88

@@ -58,7 +58,7 @@ def retrieve(
5858
extra_query: Query | None = None,
5959
extra_body: Body | None = None,
6060
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
61-
) -> Optional[Shield]:
61+
) -> Shield:
6262
"""
6363
Args:
6464
extra_headers: Send extra headers
@@ -173,7 +173,7 @@ async def retrieve(
173173
extra_query: Query | None = None,
174174
extra_body: Body | None = None,
175175
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
176-
) -> Optional[Shield]:
176+
) -> Shield:
177177
"""
178178
Args:
179179
extra_headers: Send extra headers

src/llama_stack_client/resources/vector_dbs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Type, Optional, cast
5+
from typing import Type, cast
66

77
import httpx
88

@@ -59,7 +59,7 @@ def retrieve(
5959
extra_query: Query | None = None,
6060
extra_body: Body | None = None,
6161
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
62-
) -> Optional[VectorDBRetrieveResponse]:
62+
) -> VectorDBRetrieveResponse:
6363
"""
6464
Args:
6565
extra_headers: Send extra headers
@@ -208,7 +208,7 @@ async def retrieve(
208208
extra_query: Query | None = None,
209209
extra_body: Body | None = None,
210210
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
211-
) -> Optional[VectorDBRetrieveResponse]:
211+
) -> VectorDBRetrieveResponse:
212212
"""
213213
Args:
214214
extra_headers: Send extra headers

0 commit comments

Comments
 (0)