c63a5cfe-b235-4fbe-8bbb-82a9e02a482a-python 0.1.0a6__py3-none-any.whl → 0.1.0a7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a6.dist-info → c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info}/METADATA +5 -5
- {c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a6.dist-info → c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info}/RECORD +23 -16
- gradientai/_client.py +12 -0
- gradientai/_version.py +1 -1
- gradientai/resources/agents/__init__.py +14 -0
- gradientai/resources/agents/agents.py +32 -0
- gradientai/resources/agents/chat/__init__.py +33 -0
- gradientai/resources/agents/chat/chat.py +102 -0
- gradientai/resources/agents/chat/completions.py +385 -0
- gradientai/resources/models.py +105 -77
- gradientai/types/__init__.py +3 -2
- gradientai/types/agents/chat/__init__.py +6 -0
- gradientai/types/agents/chat/completion_create_params.py +185 -0
- gradientai/types/agents/chat/completion_create_response.py +81 -0
- gradientai/types/api_model.py +32 -0
- gradientai/types/chat/__init__.py +0 -1
- gradientai/types/chat/completion_create_response.py +1 -1
- gradientai/types/model_list_params.py +42 -0
- gradientai/types/model_list_response.py +8 -5
- gradientai/types/shared/__init__.py +1 -0
- gradientai/types/model.py +0 -21
- {c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a6.dist-info → c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info}/WHEEL +0 -0
- {c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a6.dist-info → c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info}/licenses/LICENSE +0 -0
- /gradientai/types/{chat → shared}/chat_completion_token_logprob.py +0 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from .completion_create_params import CompletionCreateParams as CompletionCreateParams
|
6
|
+
from .completion_create_response import CompletionCreateResponse as CompletionCreateResponse
|
@@ -0,0 +1,185 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from typing import Dict, List, Union, Iterable, Optional
|
6
|
+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
|
7
|
+
|
8
|
+
__all__ = [
|
9
|
+
"CompletionCreateParams",
|
10
|
+
"Message",
|
11
|
+
"MessageChatCompletionRequestSystemMessage",
|
12
|
+
"MessageChatCompletionRequestDeveloperMessage",
|
13
|
+
"MessageChatCompletionRequestUserMessage",
|
14
|
+
"MessageChatCompletionRequestAssistantMessage",
|
15
|
+
"StreamOptions",
|
16
|
+
]
|
17
|
+
|
18
|
+
|
19
|
+
class CompletionCreateParams(TypedDict, total=False):
|
20
|
+
messages: Required[Iterable[Message]]
|
21
|
+
"""A list of messages comprising the conversation so far."""
|
22
|
+
|
23
|
+
model: Required[str]
|
24
|
+
"""Model ID used to generate the response."""
|
25
|
+
|
26
|
+
frequency_penalty: Optional[float]
|
27
|
+
"""Number between -2.0 and 2.0.
|
28
|
+
|
29
|
+
Positive values penalize new tokens based on their existing frequency in the
|
30
|
+
text so far, decreasing the model's likelihood to repeat the same line verbatim.
|
31
|
+
"""
|
32
|
+
|
33
|
+
logit_bias: Optional[Dict[str, int]]
|
34
|
+
"""Modify the likelihood of specified tokens appearing in the completion.
|
35
|
+
|
36
|
+
Accepts a JSON object that maps tokens (specified by their token ID in the
|
37
|
+
tokenizer) to an associated bias value from -100 to 100. Mathematically, the
|
38
|
+
bias is added to the logits generated by the model prior to sampling. The exact
|
39
|
+
effect will vary per model, but values between -1 and 1 should decrease or
|
40
|
+
increase likelihood of selection; values like -100 or 100 should result in a ban
|
41
|
+
or exclusive selection of the relevant token.
|
42
|
+
"""
|
43
|
+
|
44
|
+
logprobs: Optional[bool]
|
45
|
+
"""Whether to return log probabilities of the output tokens or not.
|
46
|
+
|
47
|
+
If true, returns the log probabilities of each output token returned in the
|
48
|
+
`content` of `message`.
|
49
|
+
"""
|
50
|
+
|
51
|
+
max_completion_tokens: Optional[int]
|
52
|
+
"""
|
53
|
+
The maximum number of completion tokens that may be used over the course of the
|
54
|
+
run. The run will make a best effort to use only the number of completion tokens
|
55
|
+
specified, across multiple turns of the run.
|
56
|
+
"""
|
57
|
+
|
58
|
+
max_tokens: Optional[int]
|
59
|
+
"""The maximum number of tokens that can be generated in the completion.
|
60
|
+
|
61
|
+
The token count of your prompt plus `max_tokens` cannot exceed the model's
|
62
|
+
context length.
|
63
|
+
"""
|
64
|
+
|
65
|
+
metadata: Optional[Dict[str, str]]
|
66
|
+
"""Set of 16 key-value pairs that can be attached to an object.
|
67
|
+
|
68
|
+
This can be useful for storing additional information about the object in a
|
69
|
+
structured format, and querying for objects via API or the dashboard.
|
70
|
+
|
71
|
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
72
|
+
a maximum length of 512 characters.
|
73
|
+
"""
|
74
|
+
|
75
|
+
n: Optional[int]
|
76
|
+
"""How many chat completion choices to generate for each input message.
|
77
|
+
|
78
|
+
Note that you will be charged based on the number of generated tokens across all
|
79
|
+
of the choices. Keep `n` as `1` to minimize costs.
|
80
|
+
"""
|
81
|
+
|
82
|
+
presence_penalty: Optional[float]
|
83
|
+
"""Number between -2.0 and 2.0.
|
84
|
+
|
85
|
+
Positive values penalize new tokens based on whether they appear in the text so
|
86
|
+
far, increasing the model's likelihood to talk about new topics.
|
87
|
+
"""
|
88
|
+
|
89
|
+
stop: Union[Optional[str], List[str], None]
|
90
|
+
"""Up to 4 sequences where the API will stop generating further tokens.
|
91
|
+
|
92
|
+
The returned text will not contain the stop sequence.
|
93
|
+
"""
|
94
|
+
|
95
|
+
stream: Optional[bool]
|
96
|
+
"""
|
97
|
+
If set to true, the model response data will be streamed to the client as it is
|
98
|
+
generated using server-sent events.
|
99
|
+
"""
|
100
|
+
|
101
|
+
stream_options: Optional[StreamOptions]
|
102
|
+
"""Options for streaming response. Only set this when you set `stream: true`."""
|
103
|
+
|
104
|
+
temperature: Optional[float]
|
105
|
+
"""What sampling temperature to use, between 0 and 2.
|
106
|
+
|
107
|
+
Higher values like 0.8 will make the output more random, while lower values like
|
108
|
+
0.2 will make it more focused and deterministic. We generally recommend altering
|
109
|
+
this or `top_p` but not both.
|
110
|
+
"""
|
111
|
+
|
112
|
+
top_logprobs: Optional[int]
|
113
|
+
"""
|
114
|
+
An integer between 0 and 20 specifying the number of most likely tokens to
|
115
|
+
return at each token position, each with an associated log probability.
|
116
|
+
`logprobs` must be set to `true` if this parameter is used.
|
117
|
+
"""
|
118
|
+
|
119
|
+
top_p: Optional[float]
|
120
|
+
"""
|
121
|
+
An alternative to sampling with temperature, called nucleus sampling, where the
|
122
|
+
model considers the results of the tokens with top_p probability mass. So 0.1
|
123
|
+
means only the tokens comprising the top 10% probability mass are considered.
|
124
|
+
|
125
|
+
We generally recommend altering this or `temperature` but not both.
|
126
|
+
"""
|
127
|
+
|
128
|
+
user: str
|
129
|
+
"""
|
130
|
+
A unique identifier representing your end-user, which can help DigitalOcean to
|
131
|
+
monitor and detect abuse.
|
132
|
+
"""
|
133
|
+
|
134
|
+
|
135
|
+
class MessageChatCompletionRequestSystemMessage(TypedDict, total=False):
|
136
|
+
content: Required[Union[str, List[str]]]
|
137
|
+
"""The contents of the system message."""
|
138
|
+
|
139
|
+
role: Required[Literal["system"]]
|
140
|
+
"""The role of the messages author, in this case `system`."""
|
141
|
+
|
142
|
+
|
143
|
+
class MessageChatCompletionRequestDeveloperMessage(TypedDict, total=False):
|
144
|
+
content: Required[Union[str, List[str]]]
|
145
|
+
"""The contents of the developer message."""
|
146
|
+
|
147
|
+
role: Required[Literal["developer"]]
|
148
|
+
"""The role of the messages author, in this case `developer`."""
|
149
|
+
|
150
|
+
|
151
|
+
class MessageChatCompletionRequestUserMessage(TypedDict, total=False):
|
152
|
+
content: Required[Union[str, List[str]]]
|
153
|
+
"""The contents of the user message."""
|
154
|
+
|
155
|
+
role: Required[Literal["user"]]
|
156
|
+
"""The role of the messages author, in this case `user`."""
|
157
|
+
|
158
|
+
|
159
|
+
class MessageChatCompletionRequestAssistantMessage(TypedDict, total=False):
|
160
|
+
role: Required[Literal["assistant"]]
|
161
|
+
"""The role of the messages author, in this case `assistant`."""
|
162
|
+
|
163
|
+
content: Union[str, List[str], None]
|
164
|
+
"""The contents of the assistant message."""
|
165
|
+
|
166
|
+
|
167
|
+
Message: TypeAlias = Union[
|
168
|
+
MessageChatCompletionRequestSystemMessage,
|
169
|
+
MessageChatCompletionRequestDeveloperMessage,
|
170
|
+
MessageChatCompletionRequestUserMessage,
|
171
|
+
MessageChatCompletionRequestAssistantMessage,
|
172
|
+
]
|
173
|
+
|
174
|
+
|
175
|
+
class StreamOptions(TypedDict, total=False):
|
176
|
+
include_usage: bool
|
177
|
+
"""If set, an additional chunk will be streamed before the `data: [DONE]` message.
|
178
|
+
|
179
|
+
The `usage` field on this chunk shows the token usage statistics for the entire
|
180
|
+
request, and the `choices` field will always be an empty array.
|
181
|
+
|
182
|
+
All other chunks will also include a `usage` field, but with a null value.
|
183
|
+
**NOTE:** If the stream is interrupted, you may not receive the final usage
|
184
|
+
chunk which contains the total token usage for the request.
|
185
|
+
"""
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from typing import List, Optional
|
4
|
+
from typing_extensions import Literal
|
5
|
+
|
6
|
+
from ...._models import BaseModel
|
7
|
+
from ...shared.chat_completion_token_logprob import ChatCompletionTokenLogprob
|
8
|
+
|
9
|
+
__all__ = ["CompletionCreateResponse", "Choice", "ChoiceLogprobs", "ChoiceMessage", "Usage"]
|
10
|
+
|
11
|
+
|
12
|
+
class ChoiceLogprobs(BaseModel):
|
13
|
+
content: Optional[List[ChatCompletionTokenLogprob]] = None
|
14
|
+
"""A list of message content tokens with log probability information."""
|
15
|
+
|
16
|
+
refusal: Optional[List[ChatCompletionTokenLogprob]] = None
|
17
|
+
"""A list of message refusal tokens with log probability information."""
|
18
|
+
|
19
|
+
|
20
|
+
class ChoiceMessage(BaseModel):
|
21
|
+
content: Optional[str] = None
|
22
|
+
"""The contents of the message."""
|
23
|
+
|
24
|
+
refusal: Optional[str] = None
|
25
|
+
"""The refusal message generated by the model."""
|
26
|
+
|
27
|
+
role: Literal["assistant"]
|
28
|
+
"""The role of the author of this message."""
|
29
|
+
|
30
|
+
|
31
|
+
class Choice(BaseModel):
|
32
|
+
finish_reason: Literal["stop", "length"]
|
33
|
+
"""The reason the model stopped generating tokens.
|
34
|
+
|
35
|
+
This will be `stop` if the model hit a natural stop point or a provided stop
|
36
|
+
sequence, or `length` if the maximum number of tokens specified in the request
|
37
|
+
was reached.
|
38
|
+
"""
|
39
|
+
|
40
|
+
index: int
|
41
|
+
"""The index of the choice in the list of choices."""
|
42
|
+
|
43
|
+
logprobs: Optional[ChoiceLogprobs] = None
|
44
|
+
"""Log probability information for the choice."""
|
45
|
+
|
46
|
+
message: ChoiceMessage
|
47
|
+
"""A chat completion message generated by the model."""
|
48
|
+
|
49
|
+
|
50
|
+
class Usage(BaseModel):
|
51
|
+
completion_tokens: int
|
52
|
+
"""Number of tokens in the generated completion."""
|
53
|
+
|
54
|
+
prompt_tokens: int
|
55
|
+
"""Number of tokens in the prompt."""
|
56
|
+
|
57
|
+
total_tokens: int
|
58
|
+
"""Total number of tokens used in the request (prompt + completion)."""
|
59
|
+
|
60
|
+
|
61
|
+
class CompletionCreateResponse(BaseModel):
|
62
|
+
id: str
|
63
|
+
"""A unique identifier for the chat completion."""
|
64
|
+
|
65
|
+
choices: List[Choice]
|
66
|
+
"""A list of chat completion choices.
|
67
|
+
|
68
|
+
Can be more than one if `n` is greater than 1.
|
69
|
+
"""
|
70
|
+
|
71
|
+
created: int
|
72
|
+
"""The Unix timestamp (in seconds) of when the chat completion was created."""
|
73
|
+
|
74
|
+
model: str
|
75
|
+
"""The model used for the chat completion."""
|
76
|
+
|
77
|
+
object: Literal["chat.completion"]
|
78
|
+
"""The object type, which is always `chat.completion`."""
|
79
|
+
|
80
|
+
usage: Optional[Usage] = None
|
81
|
+
"""Usage statistics for the completion request."""
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from typing import Optional
|
4
|
+
from datetime import datetime
|
5
|
+
|
6
|
+
from .._models import BaseModel
|
7
|
+
from .api_agreement import APIAgreement
|
8
|
+
from .api_model_version import APIModelVersion
|
9
|
+
|
10
|
+
__all__ = ["APIModel"]
|
11
|
+
|
12
|
+
|
13
|
+
class APIModel(BaseModel):
|
14
|
+
agreement: Optional[APIAgreement] = None
|
15
|
+
|
16
|
+
created_at: Optional[datetime] = None
|
17
|
+
|
18
|
+
is_foundational: Optional[bool] = None
|
19
|
+
|
20
|
+
name: Optional[str] = None
|
21
|
+
|
22
|
+
parent_uuid: Optional[str] = None
|
23
|
+
|
24
|
+
updated_at: Optional[datetime] = None
|
25
|
+
|
26
|
+
upload_complete: Optional[bool] = None
|
27
|
+
|
28
|
+
url: Optional[str] = None
|
29
|
+
|
30
|
+
uuid: Optional[str] = None
|
31
|
+
|
32
|
+
version: Optional[APIModelVersion] = None
|
@@ -4,4 +4,3 @@ from __future__ import annotations
|
|
4
4
|
|
5
5
|
from .completion_create_params import CompletionCreateParams as CompletionCreateParams
|
6
6
|
from .completion_create_response import CompletionCreateResponse as CompletionCreateResponse
|
7
|
-
from .chat_completion_token_logprob import ChatCompletionTokenLogprob as ChatCompletionTokenLogprob
|
@@ -4,7 +4,7 @@ from typing import List, Optional
|
|
4
4
|
from typing_extensions import Literal
|
5
5
|
|
6
6
|
from ..._models import BaseModel
|
7
|
-
from .chat_completion_token_logprob import ChatCompletionTokenLogprob
|
7
|
+
from ..shared.chat_completion_token_logprob import ChatCompletionTokenLogprob
|
8
8
|
|
9
9
|
__all__ = ["CompletionCreateResponse", "Choice", "ChoiceLogprobs", "ChoiceMessage", "Usage"]
|
10
10
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from typing import List
|
6
|
+
from typing_extensions import Literal, TypedDict
|
7
|
+
|
8
|
+
__all__ = ["ModelListParams"]
|
9
|
+
|
10
|
+
|
11
|
+
class ModelListParams(TypedDict, total=False):
|
12
|
+
page: int
|
13
|
+
"""page number."""
|
14
|
+
|
15
|
+
per_page: int
|
16
|
+
"""items per page."""
|
17
|
+
|
18
|
+
public_only: bool
|
19
|
+
"""only include models that are publicly available."""
|
20
|
+
|
21
|
+
usecases: List[
|
22
|
+
Literal[
|
23
|
+
"MODEL_USECASE_UNKNOWN",
|
24
|
+
"MODEL_USECASE_AGENT",
|
25
|
+
"MODEL_USECASE_FINETUNED",
|
26
|
+
"MODEL_USECASE_KNOWLEDGEBASE",
|
27
|
+
"MODEL_USECASE_GUARDRAIL",
|
28
|
+
"MODEL_USECASE_REASONING",
|
29
|
+
"MODEL_USECASE_SERVERLESS",
|
30
|
+
]
|
31
|
+
]
|
32
|
+
"""include only models defined for the listed usecases.
|
33
|
+
|
34
|
+
- MODEL_USECASE_UNKNOWN: The use case of the model is unknown
|
35
|
+
- MODEL_USECASE_AGENT: The model maybe used in an agent
|
36
|
+
- MODEL_USECASE_FINETUNED: The model maybe used for fine tuning
|
37
|
+
- MODEL_USECASE_KNOWLEDGEBASE: The model maybe used for knowledge bases
|
38
|
+
(embedding models)
|
39
|
+
- MODEL_USECASE_GUARDRAIL: The model maybe used for guardrails
|
40
|
+
- MODEL_USECASE_REASONING: The model usecase for reasoning
|
41
|
+
- MODEL_USECASE_SERVERLESS: The model usecase for serverless inference
|
42
|
+
"""
|
@@ -1,15 +1,18 @@
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
2
|
|
3
|
-
from typing import List
|
4
|
-
from typing_extensions import Literal
|
3
|
+
from typing import List, Optional
|
5
4
|
|
6
|
-
from .model import Model
|
7
5
|
from .._models import BaseModel
|
6
|
+
from .api_model import APIModel
|
7
|
+
from .shared.api_meta import APIMeta
|
8
|
+
from .shared.api_links import APILinks
|
8
9
|
|
9
10
|
__all__ = ["ModelListResponse"]
|
10
11
|
|
11
12
|
|
12
13
|
class ModelListResponse(BaseModel):
|
13
|
-
|
14
|
+
links: Optional[APILinks] = None
|
14
15
|
|
15
|
-
|
16
|
+
meta: Optional[APIMeta] = None
|
17
|
+
|
18
|
+
models: Optional[List[APIModel]] = None
|
gradientai/types/model.py
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
-
|
3
|
-
from typing_extensions import Literal
|
4
|
-
|
5
|
-
from .._models import BaseModel
|
6
|
-
|
7
|
-
__all__ = ["Model"]
|
8
|
-
|
9
|
-
|
10
|
-
class Model(BaseModel):
|
11
|
-
id: str
|
12
|
-
"""The model identifier, which can be referenced in the API endpoints."""
|
13
|
-
|
14
|
-
created: int
|
15
|
-
"""The Unix timestamp (in seconds) when the model was created."""
|
16
|
-
|
17
|
-
object: Literal["model"]
|
18
|
-
"""The object type, which is always "model"."""
|
19
|
-
|
20
|
-
owned_by: str
|
21
|
-
"""The organization that owns the model."""
|
File without changes
|
File without changes
|
File without changes
|