Skip to content

Commit c5bc3ca

Browse files
feat(api): manual updates
1 parent 4f979ce commit c5bc3ca

File tree

5 files changed

+73
-73
lines changed

5 files changed

+73
-73
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 76
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradientai-e8b3cbc80e18e4f7f277010349f25e1319156704f359911dc464cc21a0d077a6.yml
33
openapi_spec_hash: c773d792724f5647ae25a5ae4ccec208
4-
config_hash: 0bc3af28d4abd9be8bcc81f615bc832d
4+
config_hash: 651ae9b93d723d383facbf979fd97fee

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ client = GradientAI(
3131
api_key=os.environ.get("GRADIENTAI_API_KEY"), # This is the default and can be omitted
3232
)
3333

34-
completion = client.agents.chat.completions.create(
34+
completion = client.chat.completions.create(
3535
messages=[
3636
{
37-
"content": "string",
38-
"role": "system",
37+
"role": "user",
38+
"content": "What is the capital of France?",
3939
}
4040
],
41-
model="llama3-8b-instruct",
41+
model="llama3.3-70b-instruct",
4242
)
43-
print(completion.id)
43+
print(completion.choices)
4444
```
4545

4646
While you can provide an `api_key` keyword argument,
@@ -63,16 +63,16 @@ client = AsyncGradientAI(
6363

6464

6565
async def main() -> None:
66-
completion = await client.agents.chat.completions.create(
66+
completion = await client.chat.completions.create(
6767
messages=[
6868
{
69-
"content": "string",
70-
"role": "system",
69+
"role": "user",
70+
"content": "What is the capital of France?",
7171
}
7272
],
73-
model="llama3-8b-instruct",
73+
model="llama3.3-70b-instruct",
7474
)
75-
print(completion.id)
75+
print(completion.choices)
7676

7777

7878
asyncio.run(main())
@@ -105,16 +105,16 @@ async def main() -> None:
105105
api_key=os.environ.get("GRADIENTAI_API_KEY"), # This is the default and can be omitted
106106
http_client=DefaultAioHttpClient(),
107107
) as client:
108-
completion = await client.agents.chat.completions.create(
108+
completion = await client.chat.completions.create(
109109
messages=[
110110
{
111-
"content": "string",
112-
"role": "system",
111+
"role": "user",
112+
"content": "What is the capital of France?",
113113
}
114114
],
115-
model="llama3-8b-instruct",
115+
model="llama3.3-70b-instruct",
116116
)
117-
print(completion.id)
117+
print(completion.choices)
118118

119119

120120
asyncio.run(main())
@@ -138,7 +138,7 @@ from gradientai import GradientAI
138138

139139
client = GradientAI()
140140

141-
completion = client.agents.chat.completions.create(
141+
completion = client.chat.completions.create(
142142
messages=[
143143
{
144144
"content": "string",

api.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44
from gradientai.types import APILinks, APIMeta, ChatCompletionTokenLogprob
55
```
66

7+
# Chat
8+
9+
## Completions
10+
11+
Types:
12+
13+
```python
14+
from gradientai.types.chat import ChatCompletionChunk, CompletionCreateResponse
15+
```
16+
17+
Methods:
18+
19+
- <code title="post /chat/completions">client.chat.completions.<a href="./src/gradientai/resources/chat/completions.py">create</a>(\*\*<a href="src/gradientai/types/chat/completion_create_params.py">params</a>) -> <a href="./src/gradientai/types/chat/completion_create_response.py">CompletionCreateResponse</a></code>
20+
721
# Agents
822

923
Types:
@@ -389,20 +403,6 @@ Methods:
389403
- <code title="get /v2/gen-ai/indexing_jobs/{indexing_job_uuid}/data_sources">client.knowledge_bases.indexing_jobs.<a href="./src/gradientai/resources/knowledge_bases/indexing_jobs.py">retrieve_data_sources</a>(indexing_job_uuid) -> <a href="./src/gradientai/types/knowledge_bases/indexing_job_retrieve_data_sources_response.py">IndexingJobRetrieveDataSourcesResponse</a></code>
390404
- <code title="put /v2/gen-ai/indexing_jobs/{uuid}/cancel">client.knowledge_bases.indexing_jobs.<a href="./src/gradientai/resources/knowledge_bases/indexing_jobs.py">update_cancel</a>(path_uuid, \*\*<a href="src/gradientai/types/knowledge_bases/indexing_job_update_cancel_params.py">params</a>) -> <a href="./src/gradientai/types/knowledge_bases/indexing_job_update_cancel_response.py">IndexingJobUpdateCancelResponse</a></code>
391405

392-
# Chat
393-
394-
## Completions
395-
396-
Types:
397-
398-
```python
399-
from gradientai.types.chat import ChatCompletionChunk, CompletionCreateResponse
400-
```
401-
402-
Methods:
403-
404-
- <code title="post /chat/completions">client.chat.completions.<a href="./src/gradientai/resources/chat/completions.py">create</a>(\*\*<a href="src/gradientai/types/chat/completion_create_params.py">params</a>) -> <a href="./src/gradientai/types/chat/completion_create_response.py">CompletionCreateResponse</a></code>
405-
406406
# Inference
407407

408408
## APIKeys

src/gradientai/_client.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ def __init__(
119119

120120
self._default_stream_cls = Stream
121121

122+
@cached_property
123+
def chat(self) -> ChatResource:
124+
from .resources.chat import ChatResource
125+
126+
return ChatResource(self)
127+
122128
@cached_property
123129
def agents(self) -> AgentsResource:
124130
from .resources.agents import AgentsResource
@@ -143,12 +149,6 @@ def knowledge_bases(self) -> KnowledgeBasesResource:
143149

144150
return KnowledgeBasesResource(self)
145151

146-
@cached_property
147-
def chat(self) -> ChatResource:
148-
from .resources.chat import ChatResource
149-
150-
return ChatResource(self)
151-
152152
@cached_property
153153
def inference(self) -> InferenceResource:
154154
from .resources.inference import InferenceResource
@@ -359,6 +359,12 @@ def __init__(
359359

360360
self._default_stream_cls = AsyncStream
361361

362+
@cached_property
363+
def chat(self) -> AsyncChatResource:
364+
from .resources.chat import AsyncChatResource
365+
366+
return AsyncChatResource(self)
367+
362368
@cached_property
363369
def agents(self) -> AsyncAgentsResource:
364370
from .resources.agents import AsyncAgentsResource
@@ -383,12 +389,6 @@ def knowledge_bases(self) -> AsyncKnowledgeBasesResource:
383389

384390
return AsyncKnowledgeBasesResource(self)
385391

386-
@cached_property
387-
def chat(self) -> AsyncChatResource:
388-
from .resources.chat import AsyncChatResource
389-
390-
return AsyncChatResource(self)
391-
392392
@cached_property
393393
def inference(self) -> AsyncInferenceResource:
394394
from .resources.inference import AsyncInferenceResource
@@ -539,6 +539,12 @@ class GradientAIWithRawResponse:
539539
def __init__(self, client: GradientAI) -> None:
540540
self._client = client
541541

542+
@cached_property
543+
def chat(self) -> chat.ChatResourceWithRawResponse:
544+
from .resources.chat import ChatResourceWithRawResponse
545+
546+
return ChatResourceWithRawResponse(self._client.chat)
547+
542548
@cached_property
543549
def agents(self) -> agents.AgentsResourceWithRawResponse:
544550
from .resources.agents import AgentsResourceWithRawResponse
@@ -563,12 +569,6 @@ def knowledge_bases(self) -> knowledge_bases.KnowledgeBasesResourceWithRawRespon
563569

564570
return KnowledgeBasesResourceWithRawResponse(self._client.knowledge_bases)
565571

566-
@cached_property
567-
def chat(self) -> chat.ChatResourceWithRawResponse:
568-
from .resources.chat import ChatResourceWithRawResponse
569-
570-
return ChatResourceWithRawResponse(self._client.chat)
571-
572572
@cached_property
573573
def inference(self) -> inference.InferenceResourceWithRawResponse:
574574
from .resources.inference import InferenceResourceWithRawResponse
@@ -588,6 +588,12 @@ class AsyncGradientAIWithRawResponse:
588588
def __init__(self, client: AsyncGradientAI) -> None:
589589
self._client = client
590590

591+
@cached_property
592+
def chat(self) -> chat.AsyncChatResourceWithRawResponse:
593+
from .resources.chat import AsyncChatResourceWithRawResponse
594+
595+
return AsyncChatResourceWithRawResponse(self._client.chat)
596+
591597
@cached_property
592598
def agents(self) -> agents.AsyncAgentsResourceWithRawResponse:
593599
from .resources.agents import AsyncAgentsResourceWithRawResponse
@@ -612,12 +618,6 @@ def knowledge_bases(self) -> knowledge_bases.AsyncKnowledgeBasesResourceWithRawR
612618

613619
return AsyncKnowledgeBasesResourceWithRawResponse(self._client.knowledge_bases)
614620

615-
@cached_property
616-
def chat(self) -> chat.AsyncChatResourceWithRawResponse:
617-
from .resources.chat import AsyncChatResourceWithRawResponse
618-
619-
return AsyncChatResourceWithRawResponse(self._client.chat)
620-
621621
@cached_property
622622
def inference(self) -> inference.AsyncInferenceResourceWithRawResponse:
623623
from .resources.inference import AsyncInferenceResourceWithRawResponse
@@ -637,6 +637,12 @@ class GradientAIWithStreamedResponse:
637637
def __init__(self, client: GradientAI) -> None:
638638
self._client = client
639639

640+
@cached_property
641+
def chat(self) -> chat.ChatResourceWithStreamingResponse:
642+
from .resources.chat import ChatResourceWithStreamingResponse
643+
644+
return ChatResourceWithStreamingResponse(self._client.chat)
645+
640646
@cached_property
641647
def agents(self) -> agents.AgentsResourceWithStreamingResponse:
642648
from .resources.agents import AgentsResourceWithStreamingResponse
@@ -661,12 +667,6 @@ def knowledge_bases(self) -> knowledge_bases.KnowledgeBasesResourceWithStreaming
661667

662668
return KnowledgeBasesResourceWithStreamingResponse(self._client.knowledge_bases)
663669

664-
@cached_property
665-
def chat(self) -> chat.ChatResourceWithStreamingResponse:
666-
from .resources.chat import ChatResourceWithStreamingResponse
667-
668-
return ChatResourceWithStreamingResponse(self._client.chat)
669-
670670
@cached_property
671671
def inference(self) -> inference.InferenceResourceWithStreamingResponse:
672672
from .resources.inference import InferenceResourceWithStreamingResponse
@@ -686,6 +686,12 @@ class AsyncGradientAIWithStreamedResponse:
686686
def __init__(self, client: AsyncGradientAI) -> None:
687687
self._client = client
688688

689+
@cached_property
690+
def chat(self) -> chat.AsyncChatResourceWithStreamingResponse:
691+
from .resources.chat import AsyncChatResourceWithStreamingResponse
692+
693+
return AsyncChatResourceWithStreamingResponse(self._client.chat)
694+
689695
@cached_property
690696
def agents(self) -> agents.AsyncAgentsResourceWithStreamingResponse:
691697
from .resources.agents import AsyncAgentsResourceWithStreamingResponse
@@ -710,12 +716,6 @@ def knowledge_bases(self) -> knowledge_bases.AsyncKnowledgeBasesResourceWithStre
710716

711717
return AsyncKnowledgeBasesResourceWithStreamingResponse(self._client.knowledge_bases)
712718

713-
@cached_property
714-
def chat(self) -> chat.AsyncChatResourceWithStreamingResponse:
715-
from .resources.chat import AsyncChatResourceWithStreamingResponse
716-
717-
return AsyncChatResourceWithStreamingResponse(self._client.chat)
718-
719719
@cached_property
720720
def inference(self) -> inference.AsyncInferenceResourceWithStreamingResponse:
721721
from .resources.inference import AsyncInferenceResourceWithStreamingResponse

src/gradientai/resources/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@
5858
)
5959

6060
__all__ = [
61+
"ChatResource",
62+
"AsyncChatResource",
63+
"ChatResourceWithRawResponse",
64+
"AsyncChatResourceWithRawResponse",
65+
"ChatResourceWithStreamingResponse",
66+
"AsyncChatResourceWithStreamingResponse",
6167
"AgentsResource",
6268
"AsyncAgentsResource",
6369
"AgentsResourceWithRawResponse",
@@ -82,12 +88,6 @@
8288
"AsyncKnowledgeBasesResourceWithRawResponse",
8389
"KnowledgeBasesResourceWithStreamingResponse",
8490
"AsyncKnowledgeBasesResourceWithStreamingResponse",
85-
"ChatResource",
86-
"AsyncChatResource",
87-
"ChatResourceWithRawResponse",
88-
"AsyncChatResourceWithRawResponse",
89-
"ChatResourceWithStreamingResponse",
90-
"AsyncChatResourceWithStreamingResponse",
9191
"InferenceResource",
9292
"AsyncInferenceResource",
9393
"InferenceResourceWithRawResponse",

0 commit comments

Comments
 (0)