c63a5cfe-b235-4fbe-8bbb-82a9e02a482a-python 0.1.0a5__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.0a5.dist-info → c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info}/METADATA +27 -27
- c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info/RECORD +237 -0
- {do_gradientai → gradientai}/__init__.py +2 -2
- {do_gradientai → gradientai}/_base_client.py +1 -1
- {do_gradientai → gradientai}/_client.py +12 -0
- {do_gradientai → gradientai}/_response.py +4 -4
- {do_gradientai → gradientai}/_types.py +1 -1
- {do_gradientai → gradientai}/_utils/_logs.py +2 -2
- {do_gradientai → gradientai}/_utils/_resources_proxy.py +4 -4
- {do_gradientai → gradientai}/_version.py +2 -2
- {do_gradientai → gradientai}/resources/agents/__init__.py +14 -0
- {do_gradientai → gradientai}/resources/agents/agents.py +32 -0
- gradientai/resources/agents/chat/chat.py +102 -0
- gradientai/resources/agents/chat/completions.py +385 -0
- gradientai/resources/chat/__init__.py +33 -0
- {do_gradientai → gradientai}/resources/models.py +105 -77
- {do_gradientai → gradientai}/types/__init__.py +3 -2
- {do_gradientai/types → gradientai/types/agents}/chat/__init__.py +0 -1
- gradientai/types/agents/chat/completion_create_response.py +81 -0
- gradientai/types/api_model.py +32 -0
- gradientai/types/chat/__init__.py +6 -0
- gradientai/types/chat/completion_create_params.py +185 -0
- {do_gradientai → gradientai}/types/chat/completion_create_response.py +1 -1
- gradientai/types/model_list_params.py +42 -0
- gradientai/types/model_list_response.py +18 -0
- {do_gradientai → gradientai}/types/shared/__init__.py +1 -0
- c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a5.dist-info/RECORD +0 -230
- do_gradientai/types/model.py +0 -21
- do_gradientai/types/model_list_response.py +0 -15
- {c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a5.dist-info → c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info}/WHEEL +0 -0
- {c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a5.dist-info → c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a7.dist-info}/licenses/LICENSE +0 -0
- {do_gradientai → gradientai}/_compat.py +0 -0
- {do_gradientai → gradientai}/_constants.py +0 -0
- {do_gradientai → gradientai}/_exceptions.py +0 -0
- {do_gradientai → gradientai}/_files.py +0 -0
- {do_gradientai → gradientai}/_models.py +0 -0
- {do_gradientai → gradientai}/_qs.py +0 -0
- {do_gradientai → gradientai}/_resource.py +0 -0
- {do_gradientai → gradientai}/_streaming.py +0 -0
- {do_gradientai → gradientai}/_utils/__init__.py +0 -0
- {do_gradientai → gradientai}/_utils/_proxy.py +0 -0
- {do_gradientai → gradientai}/_utils/_reflection.py +0 -0
- {do_gradientai → gradientai}/_utils/_streams.py +0 -0
- {do_gradientai → gradientai}/_utils/_sync.py +0 -0
- {do_gradientai → gradientai}/_utils/_transform.py +0 -0
- {do_gradientai → gradientai}/_utils/_typing.py +0 -0
- {do_gradientai → gradientai}/_utils/_utils.py +0 -0
- {do_gradientai → gradientai}/lib/.keep +0 -0
- {do_gradientai → gradientai}/py.typed +0 -0
- {do_gradientai → gradientai}/resources/__init__.py +0 -0
- {do_gradientai → gradientai}/resources/agents/api_keys.py +0 -0
- {do_gradientai/resources → gradientai/resources/agents}/chat/__init__.py +0 -0
- {do_gradientai → gradientai}/resources/agents/evaluation_datasets.py +0 -0
- {do_gradientai → gradientai}/resources/agents/evaluation_metrics/__init__.py +0 -0
- {do_gradientai → gradientai}/resources/agents/evaluation_metrics/evaluation_metrics.py +0 -0
- {do_gradientai → gradientai}/resources/agents/evaluation_metrics/workspaces/__init__.py +0 -0
- {do_gradientai → gradientai}/resources/agents/evaluation_metrics/workspaces/agents.py +0 -0
- {do_gradientai → gradientai}/resources/agents/evaluation_metrics/workspaces/workspaces.py +0 -0
- {do_gradientai → gradientai}/resources/agents/evaluation_runs.py +0 -0
- {do_gradientai → gradientai}/resources/agents/evaluation_test_cases.py +0 -0
- {do_gradientai → gradientai}/resources/agents/functions.py +0 -0
- {do_gradientai → gradientai}/resources/agents/knowledge_bases.py +0 -0
- {do_gradientai → gradientai}/resources/agents/routes.py +0 -0
- {do_gradientai → gradientai}/resources/agents/versions.py +0 -0
- {do_gradientai → gradientai}/resources/chat/chat.py +0 -0
- {do_gradientai → gradientai}/resources/chat/completions.py +0 -0
- {do_gradientai → gradientai}/resources/inference/__init__.py +0 -0
- {do_gradientai → gradientai}/resources/inference/api_keys.py +0 -0
- {do_gradientai → gradientai}/resources/inference/inference.py +0 -0
- {do_gradientai → gradientai}/resources/knowledge_bases/__init__.py +0 -0
- {do_gradientai → gradientai}/resources/knowledge_bases/data_sources.py +0 -0
- {do_gradientai → gradientai}/resources/knowledge_bases/indexing_jobs.py +0 -0
- {do_gradientai → gradientai}/resources/knowledge_bases/knowledge_bases.py +0 -0
- {do_gradientai → gradientai}/resources/model_providers/__init__.py +0 -0
- {do_gradientai → gradientai}/resources/model_providers/anthropic/__init__.py +0 -0
- {do_gradientai → gradientai}/resources/model_providers/anthropic/anthropic.py +0 -0
- {do_gradientai → gradientai}/resources/model_providers/anthropic/keys.py +0 -0
- {do_gradientai → gradientai}/resources/model_providers/model_providers.py +0 -0
- {do_gradientai → gradientai}/resources/model_providers/openai/__init__.py +0 -0
- {do_gradientai → gradientai}/resources/model_providers/openai/keys.py +0 -0
- {do_gradientai → gradientai}/resources/model_providers/openai/openai.py +0 -0
- {do_gradientai → gradientai}/resources/regions.py +0 -0
- {do_gradientai → gradientai}/types/agent_create_params.py +0 -0
- {do_gradientai → gradientai}/types/agent_create_response.py +0 -0
- {do_gradientai → gradientai}/types/agent_delete_response.py +0 -0
- {do_gradientai → gradientai}/types/agent_list_params.py +0 -0
- {do_gradientai → gradientai}/types/agent_list_response.py +0 -0
- {do_gradientai → gradientai}/types/agent_retrieve_response.py +0 -0
- {do_gradientai → gradientai}/types/agent_update_params.py +0 -0
- {do_gradientai → gradientai}/types/agent_update_response.py +0 -0
- {do_gradientai → gradientai}/types/agent_update_status_params.py +0 -0
- {do_gradientai → gradientai}/types/agent_update_status_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/__init__.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_evaluation_metric.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_evaluation_metric_result.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_evaluation_prompt.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_evaluation_run.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_evaluation_test_case.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_key_create_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_key_create_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_key_delete_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_key_list_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_key_list_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_key_regenerate_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_key_update_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_key_update_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_link_knowledge_base_output.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_star_metric.py +0 -0
- {do_gradientai → gradientai}/types/agents/api_star_metric_param.py +0 -0
- {do_gradientai/types → gradientai/types/agents}/chat/completion_create_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_dataset_create_file_upload_presigned_urls_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_dataset_create_file_upload_presigned_urls_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_dataset_create_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_dataset_create_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metric_list_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metrics/__init__.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metrics/workspace_create_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metrics/workspace_create_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metrics/workspace_delete_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metrics/workspace_list_evaluation_test_cases_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metrics/workspace_list_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metrics/workspace_retrieve_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metrics/workspace_update_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metrics/workspace_update_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metrics/workspaces/__init__.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metrics/workspaces/agent_list_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metrics/workspaces/agent_list_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metrics/workspaces/agent_move_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_metrics/workspaces/agent_move_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_run_create_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_run_create_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_run_list_results_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_run_retrieve_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_run_retrieve_results_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_test_case_create_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_test_case_create_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_test_case_list_evaluation_runs_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_test_case_list_evaluation_runs_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_test_case_list_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_test_case_retrieve_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_test_case_retrieve_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_test_case_update_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/evaluation_test_case_update_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/function_create_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/function_create_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/function_delete_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/function_update_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/function_update_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/knowledge_base_detach_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/route_add_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/route_add_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/route_delete_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/route_update_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/route_update_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/route_view_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/version_list_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/version_list_response.py +0 -0
- {do_gradientai → gradientai}/types/agents/version_update_params.py +0 -0
- {do_gradientai → gradientai}/types/agents/version_update_response.py +0 -0
- {do_gradientai → gradientai}/types/api_agent.py +0 -0
- {do_gradientai → gradientai}/types/api_agent_api_key_info.py +0 -0
- {do_gradientai → gradientai}/types/api_agent_model.py +0 -0
- {do_gradientai → gradientai}/types/api_agreement.py +0 -0
- {do_gradientai → gradientai}/types/api_anthropic_api_key_info.py +0 -0
- {do_gradientai → gradientai}/types/api_deployment_visibility.py +0 -0
- {do_gradientai → gradientai}/types/api_knowledge_base.py +0 -0
- {do_gradientai → gradientai}/types/api_model_version.py +0 -0
- {do_gradientai → gradientai}/types/api_openai_api_key_info.py +0 -0
- {do_gradientai → gradientai}/types/api_retrieval_method.py +0 -0
- {do_gradientai → gradientai}/types/api_workspace.py +0 -0
- {do_gradientai → gradientai}/types/inference/__init__.py +0 -0
- {do_gradientai → gradientai}/types/inference/api_key_create_params.py +0 -0
- {do_gradientai → gradientai}/types/inference/api_key_create_response.py +0 -0
- {do_gradientai → gradientai}/types/inference/api_key_delete_response.py +0 -0
- {do_gradientai → gradientai}/types/inference/api_key_list_params.py +0 -0
- {do_gradientai → gradientai}/types/inference/api_key_list_response.py +0 -0
- {do_gradientai → gradientai}/types/inference/api_key_update_params.py +0 -0
- {do_gradientai → gradientai}/types/inference/api_key_update_regenerate_response.py +0 -0
- {do_gradientai → gradientai}/types/inference/api_key_update_response.py +0 -0
- {do_gradientai → gradientai}/types/inference/api_model_api_key_info.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_base_create_params.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_base_create_response.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_base_delete_response.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_base_list_params.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_base_list_response.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_base_retrieve_response.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_base_update_params.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_base_update_response.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/__init__.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/api_file_upload_data_source.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/api_file_upload_data_source_param.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/api_indexed_data_source.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/api_indexing_job.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/api_knowledge_base_data_source.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/api_spaces_data_source.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/api_spaces_data_source_param.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/api_web_crawler_data_source.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/api_web_crawler_data_source_param.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/aws_data_source_param.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/data_source_create_params.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/data_source_create_response.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/data_source_delete_response.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/data_source_list_params.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/data_source_list_response.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/indexing_job_create_params.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/indexing_job_create_response.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/indexing_job_list_params.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/indexing_job_list_response.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/indexing_job_retrieve_data_sources_response.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/indexing_job_retrieve_response.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/indexing_job_update_cancel_params.py +0 -0
- {do_gradientai → gradientai}/types/knowledge_bases/indexing_job_update_cancel_response.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/__init__.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/anthropic/__init__.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/anthropic/key_create_params.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/anthropic/key_create_response.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/anthropic/key_delete_response.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/anthropic/key_list_agents_params.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/anthropic/key_list_agents_response.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/anthropic/key_list_params.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/anthropic/key_list_response.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/anthropic/key_retrieve_response.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/anthropic/key_update_params.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/anthropic/key_update_response.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/openai/__init__.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/openai/key_create_params.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/openai/key_create_response.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/openai/key_delete_response.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/openai/key_list_params.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/openai/key_list_response.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/openai/key_retrieve_agents_params.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/openai/key_retrieve_agents_response.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/openai/key_retrieve_response.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/openai/key_update_params.py +0 -0
- {do_gradientai → gradientai}/types/model_providers/openai/key_update_response.py +0 -0
- {do_gradientai → gradientai}/types/region_list_params.py +0 -0
- {do_gradientai → gradientai}/types/region_list_response.py +0 -0
- {do_gradientai → gradientai}/types/shared/api_links.py +0 -0
- {do_gradientai → gradientai}/types/shared/api_meta.py +0 -0
- {do_gradientai/types/chat → gradientai/types/shared}/chat_completion_token_logprob.py +0 -0
@@ -1,5 +1,13 @@
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
2
|
|
3
|
+
from .chat import (
|
4
|
+
ChatResource,
|
5
|
+
AsyncChatResource,
|
6
|
+
ChatResourceWithRawResponse,
|
7
|
+
AsyncChatResourceWithRawResponse,
|
8
|
+
ChatResourceWithStreamingResponse,
|
9
|
+
AsyncChatResourceWithStreamingResponse,
|
10
|
+
)
|
3
11
|
from .agents import (
|
4
12
|
AgentsResource,
|
5
13
|
AsyncAgentsResource,
|
@@ -88,6 +96,12 @@ __all__ = [
|
|
88
96
|
"AsyncAPIKeysResourceWithRawResponse",
|
89
97
|
"APIKeysResourceWithStreamingResponse",
|
90
98
|
"AsyncAPIKeysResourceWithStreamingResponse",
|
99
|
+
"ChatResource",
|
100
|
+
"AsyncChatResource",
|
101
|
+
"ChatResourceWithRawResponse",
|
102
|
+
"AsyncChatResourceWithRawResponse",
|
103
|
+
"ChatResourceWithStreamingResponse",
|
104
|
+
"AsyncChatResourceWithStreamingResponse",
|
91
105
|
"EvaluationMetricsResource",
|
92
106
|
"AsyncEvaluationMetricsResource",
|
93
107
|
"EvaluationMetricsResourceWithRawResponse",
|
@@ -41,6 +41,14 @@ from .versions import (
|
|
41
41
|
AsyncVersionsResourceWithStreamingResponse,
|
42
42
|
)
|
43
43
|
from ..._compat import cached_property
|
44
|
+
from .chat.chat import (
|
45
|
+
ChatResource,
|
46
|
+
AsyncChatResource,
|
47
|
+
ChatResourceWithRawResponse,
|
48
|
+
AsyncChatResourceWithRawResponse,
|
49
|
+
ChatResourceWithStreamingResponse,
|
50
|
+
AsyncChatResourceWithStreamingResponse,
|
51
|
+
)
|
44
52
|
from .functions import (
|
45
53
|
FunctionsResource,
|
46
54
|
AsyncFunctionsResource,
|
@@ -114,6 +122,10 @@ class AgentsResource(SyncAPIResource):
|
|
114
122
|
def api_keys(self) -> APIKeysResource:
|
115
123
|
return APIKeysResource(self._client)
|
116
124
|
|
125
|
+
@cached_property
|
126
|
+
def chat(self) -> ChatResource:
|
127
|
+
return ChatResource(self._client)
|
128
|
+
|
117
129
|
@cached_property
|
118
130
|
def evaluation_metrics(self) -> EvaluationMetricsResource:
|
119
131
|
return EvaluationMetricsResource(self._client)
|
@@ -498,6 +510,10 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
498
510
|
def api_keys(self) -> AsyncAPIKeysResource:
|
499
511
|
return AsyncAPIKeysResource(self._client)
|
500
512
|
|
513
|
+
@cached_property
|
514
|
+
def chat(self) -> AsyncChatResource:
|
515
|
+
return AsyncChatResource(self._client)
|
516
|
+
|
501
517
|
@cached_property
|
502
518
|
def evaluation_metrics(self) -> AsyncEvaluationMetricsResource:
|
503
519
|
return AsyncEvaluationMetricsResource(self._client)
|
@@ -904,6 +920,10 @@ class AgentsResourceWithRawResponse:
|
|
904
920
|
def api_keys(self) -> APIKeysResourceWithRawResponse:
|
905
921
|
return APIKeysResourceWithRawResponse(self._agents.api_keys)
|
906
922
|
|
923
|
+
@cached_property
|
924
|
+
def chat(self) -> ChatResourceWithRawResponse:
|
925
|
+
return ChatResourceWithRawResponse(self._agents.chat)
|
926
|
+
|
907
927
|
@cached_property
|
908
928
|
def evaluation_metrics(self) -> EvaluationMetricsResourceWithRawResponse:
|
909
929
|
return EvaluationMetricsResourceWithRawResponse(self._agents.evaluation_metrics)
|
@@ -964,6 +984,10 @@ class AsyncAgentsResourceWithRawResponse:
|
|
964
984
|
def api_keys(self) -> AsyncAPIKeysResourceWithRawResponse:
|
965
985
|
return AsyncAPIKeysResourceWithRawResponse(self._agents.api_keys)
|
966
986
|
|
987
|
+
@cached_property
|
988
|
+
def chat(self) -> AsyncChatResourceWithRawResponse:
|
989
|
+
return AsyncChatResourceWithRawResponse(self._agents.chat)
|
990
|
+
|
967
991
|
@cached_property
|
968
992
|
def evaluation_metrics(self) -> AsyncEvaluationMetricsResourceWithRawResponse:
|
969
993
|
return AsyncEvaluationMetricsResourceWithRawResponse(self._agents.evaluation_metrics)
|
@@ -1024,6 +1048,10 @@ class AgentsResourceWithStreamingResponse:
|
|
1024
1048
|
def api_keys(self) -> APIKeysResourceWithStreamingResponse:
|
1025
1049
|
return APIKeysResourceWithStreamingResponse(self._agents.api_keys)
|
1026
1050
|
|
1051
|
+
@cached_property
|
1052
|
+
def chat(self) -> ChatResourceWithStreamingResponse:
|
1053
|
+
return ChatResourceWithStreamingResponse(self._agents.chat)
|
1054
|
+
|
1027
1055
|
@cached_property
|
1028
1056
|
def evaluation_metrics(self) -> EvaluationMetricsResourceWithStreamingResponse:
|
1029
1057
|
return EvaluationMetricsResourceWithStreamingResponse(self._agents.evaluation_metrics)
|
@@ -1084,6 +1112,10 @@ class AsyncAgentsResourceWithStreamingResponse:
|
|
1084
1112
|
def api_keys(self) -> AsyncAPIKeysResourceWithStreamingResponse:
|
1085
1113
|
return AsyncAPIKeysResourceWithStreamingResponse(self._agents.api_keys)
|
1086
1114
|
|
1115
|
+
@cached_property
|
1116
|
+
def chat(self) -> AsyncChatResourceWithStreamingResponse:
|
1117
|
+
return AsyncChatResourceWithStreamingResponse(self._agents.chat)
|
1118
|
+
|
1087
1119
|
@cached_property
|
1088
1120
|
def evaluation_metrics(self) -> AsyncEvaluationMetricsResourceWithStreamingResponse:
|
1089
1121
|
return AsyncEvaluationMetricsResourceWithStreamingResponse(self._agents.evaluation_metrics)
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from ...._compat import cached_property
|
6
|
+
from .completions import (
|
7
|
+
CompletionsResource,
|
8
|
+
AsyncCompletionsResource,
|
9
|
+
CompletionsResourceWithRawResponse,
|
10
|
+
AsyncCompletionsResourceWithRawResponse,
|
11
|
+
CompletionsResourceWithStreamingResponse,
|
12
|
+
AsyncCompletionsResourceWithStreamingResponse,
|
13
|
+
)
|
14
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
15
|
+
|
16
|
+
__all__ = ["ChatResource", "AsyncChatResource"]
|
17
|
+
|
18
|
+
|
19
|
+
class ChatResource(SyncAPIResource):
|
20
|
+
@cached_property
|
21
|
+
def completions(self) -> CompletionsResource:
|
22
|
+
return CompletionsResource(self._client)
|
23
|
+
|
24
|
+
@cached_property
|
25
|
+
def with_raw_response(self) -> ChatResourceWithRawResponse:
|
26
|
+
"""
|
27
|
+
This property can be used as a prefix for any HTTP method call to return
|
28
|
+
the raw response object instead of the parsed content.
|
29
|
+
|
30
|
+
For more information, see https://www.github.com/digitalocean/gradientai-python#accessing-raw-response-data-eg-headers
|
31
|
+
"""
|
32
|
+
return ChatResourceWithRawResponse(self)
|
33
|
+
|
34
|
+
@cached_property
|
35
|
+
def with_streaming_response(self) -> ChatResourceWithStreamingResponse:
|
36
|
+
"""
|
37
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
38
|
+
|
39
|
+
For more information, see https://www.github.com/digitalocean/gradientai-python#with_streaming_response
|
40
|
+
"""
|
41
|
+
return ChatResourceWithStreamingResponse(self)
|
42
|
+
|
43
|
+
|
44
|
+
class AsyncChatResource(AsyncAPIResource):
|
45
|
+
@cached_property
|
46
|
+
def completions(self) -> AsyncCompletionsResource:
|
47
|
+
return AsyncCompletionsResource(self._client)
|
48
|
+
|
49
|
+
@cached_property
|
50
|
+
def with_raw_response(self) -> AsyncChatResourceWithRawResponse:
|
51
|
+
"""
|
52
|
+
This property can be used as a prefix for any HTTP method call to return
|
53
|
+
the raw response object instead of the parsed content.
|
54
|
+
|
55
|
+
For more information, see https://www.github.com/digitalocean/gradientai-python#accessing-raw-response-data-eg-headers
|
56
|
+
"""
|
57
|
+
return AsyncChatResourceWithRawResponse(self)
|
58
|
+
|
59
|
+
@cached_property
|
60
|
+
def with_streaming_response(self) -> AsyncChatResourceWithStreamingResponse:
|
61
|
+
"""
|
62
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
63
|
+
|
64
|
+
For more information, see https://www.github.com/digitalocean/gradientai-python#with_streaming_response
|
65
|
+
"""
|
66
|
+
return AsyncChatResourceWithStreamingResponse(self)
|
67
|
+
|
68
|
+
|
69
|
+
class ChatResourceWithRawResponse:
|
70
|
+
def __init__(self, chat: ChatResource) -> None:
|
71
|
+
self._chat = chat
|
72
|
+
|
73
|
+
@cached_property
|
74
|
+
def completions(self) -> CompletionsResourceWithRawResponse:
|
75
|
+
return CompletionsResourceWithRawResponse(self._chat.completions)
|
76
|
+
|
77
|
+
|
78
|
+
class AsyncChatResourceWithRawResponse:
|
79
|
+
def __init__(self, chat: AsyncChatResource) -> None:
|
80
|
+
self._chat = chat
|
81
|
+
|
82
|
+
@cached_property
|
83
|
+
def completions(self) -> AsyncCompletionsResourceWithRawResponse:
|
84
|
+
return AsyncCompletionsResourceWithRawResponse(self._chat.completions)
|
85
|
+
|
86
|
+
|
87
|
+
class ChatResourceWithStreamingResponse:
|
88
|
+
def __init__(self, chat: ChatResource) -> None:
|
89
|
+
self._chat = chat
|
90
|
+
|
91
|
+
@cached_property
|
92
|
+
def completions(self) -> CompletionsResourceWithStreamingResponse:
|
93
|
+
return CompletionsResourceWithStreamingResponse(self._chat.completions)
|
94
|
+
|
95
|
+
|
96
|
+
class AsyncChatResourceWithStreamingResponse:
|
97
|
+
def __init__(self, chat: AsyncChatResource) -> None:
|
98
|
+
self._chat = chat
|
99
|
+
|
100
|
+
@cached_property
|
101
|
+
def completions(self) -> AsyncCompletionsResourceWithStreamingResponse:
|
102
|
+
return AsyncCompletionsResourceWithStreamingResponse(self._chat.completions)
|
@@ -0,0 +1,385 @@
|
|
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
|
+
|
7
|
+
import httpx
|
8
|
+
|
9
|
+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
10
|
+
from ...._utils import maybe_transform, async_maybe_transform
|
11
|
+
from ...._compat import cached_property
|
12
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
13
|
+
from ...._response import (
|
14
|
+
to_raw_response_wrapper,
|
15
|
+
to_streamed_response_wrapper,
|
16
|
+
async_to_raw_response_wrapper,
|
17
|
+
async_to_streamed_response_wrapper,
|
18
|
+
)
|
19
|
+
from ...._base_client import make_request_options
|
20
|
+
from ....types.agents.chat import completion_create_params
|
21
|
+
from ....types.agents.chat.completion_create_response import CompletionCreateResponse
|
22
|
+
|
23
|
+
__all__ = ["CompletionsResource", "AsyncCompletionsResource"]
|
24
|
+
|
25
|
+
|
26
|
+
class CompletionsResource(SyncAPIResource):
|
27
|
+
@cached_property
|
28
|
+
def with_raw_response(self) -> CompletionsResourceWithRawResponse:
|
29
|
+
"""
|
30
|
+
This property can be used as a prefix for any HTTP method call to return
|
31
|
+
the raw response object instead of the parsed content.
|
32
|
+
|
33
|
+
For more information, see https://www.github.com/digitalocean/gradientai-python#accessing-raw-response-data-eg-headers
|
34
|
+
"""
|
35
|
+
return CompletionsResourceWithRawResponse(self)
|
36
|
+
|
37
|
+
@cached_property
|
38
|
+
def with_streaming_response(self) -> CompletionsResourceWithStreamingResponse:
|
39
|
+
"""
|
40
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
41
|
+
|
42
|
+
For more information, see https://www.github.com/digitalocean/gradientai-python#with_streaming_response
|
43
|
+
"""
|
44
|
+
return CompletionsResourceWithStreamingResponse(self)
|
45
|
+
|
46
|
+
def create(
|
47
|
+
self,
|
48
|
+
*,
|
49
|
+
messages: Iterable[completion_create_params.Message],
|
50
|
+
model: str,
|
51
|
+
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
|
52
|
+
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
|
53
|
+
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
|
54
|
+
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
|
55
|
+
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
|
56
|
+
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
57
|
+
n: Optional[int] | NotGiven = NOT_GIVEN,
|
58
|
+
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
|
59
|
+
stop: Union[Optional[str], List[str], None] | NotGiven = NOT_GIVEN,
|
60
|
+
stream: Optional[bool] | NotGiven = NOT_GIVEN,
|
61
|
+
stream_options: Optional[completion_create_params.StreamOptions] | NotGiven = NOT_GIVEN,
|
62
|
+
temperature: Optional[float] | NotGiven = NOT_GIVEN,
|
63
|
+
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
|
64
|
+
top_p: Optional[float] | NotGiven = NOT_GIVEN,
|
65
|
+
user: str | NotGiven = NOT_GIVEN,
|
66
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
67
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
68
|
+
extra_headers: Headers | None = None,
|
69
|
+
extra_query: Query | None = None,
|
70
|
+
extra_body: Body | None = None,
|
71
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
72
|
+
) -> CompletionCreateResponse:
|
73
|
+
"""
|
74
|
+
Creates a model response for the given chat conversation.
|
75
|
+
|
76
|
+
Args:
|
77
|
+
messages: A list of messages comprising the conversation so far.
|
78
|
+
|
79
|
+
model: Model ID used to generate the response.
|
80
|
+
|
81
|
+
frequency_penalty: Number between -2.0 and 2.0. Positive values penalize new tokens based on their
|
82
|
+
existing frequency in the text so far, decreasing the model's likelihood to
|
83
|
+
repeat the same line verbatim.
|
84
|
+
|
85
|
+
logit_bias: Modify the likelihood of specified tokens appearing in the completion.
|
86
|
+
|
87
|
+
Accepts a JSON object that maps tokens (specified by their token ID in the
|
88
|
+
tokenizer) to an associated bias value from -100 to 100. Mathematically, the
|
89
|
+
bias is added to the logits generated by the model prior to sampling. The exact
|
90
|
+
effect will vary per model, but values between -1 and 1 should decrease or
|
91
|
+
increase likelihood of selection; values like -100 or 100 should result in a ban
|
92
|
+
or exclusive selection of the relevant token.
|
93
|
+
|
94
|
+
logprobs: Whether to return log probabilities of the output tokens or not. If true,
|
95
|
+
returns the log probabilities of each output token returned in the `content` of
|
96
|
+
`message`.
|
97
|
+
|
98
|
+
max_completion_tokens: The maximum number of completion tokens that may be used over the course of the
|
99
|
+
run. The run will make a best effort to use only the number of completion tokens
|
100
|
+
specified, across multiple turns of the run.
|
101
|
+
|
102
|
+
max_tokens: The maximum number of tokens that can be generated in the completion.
|
103
|
+
|
104
|
+
The token count of your prompt plus `max_tokens` cannot exceed the model's
|
105
|
+
context length.
|
106
|
+
|
107
|
+
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
|
108
|
+
for storing additional information about the object in a structured format, and
|
109
|
+
querying for objects via API or the dashboard.
|
110
|
+
|
111
|
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
112
|
+
a maximum length of 512 characters.
|
113
|
+
|
114
|
+
n: How many chat completion choices to generate for each input message. Note that
|
115
|
+
you will be charged based on the number of generated tokens across all of the
|
116
|
+
choices. Keep `n` as `1` to minimize costs.
|
117
|
+
|
118
|
+
presence_penalty: Number between -2.0 and 2.0. Positive values penalize new tokens based on
|
119
|
+
whether they appear in the text so far, increasing the model's likelihood to
|
120
|
+
talk about new topics.
|
121
|
+
|
122
|
+
stop: Up to 4 sequences where the API will stop generating further tokens. The
|
123
|
+
returned text will not contain the stop sequence.
|
124
|
+
|
125
|
+
stream: If set to true, the model response data will be streamed to the client as it is
|
126
|
+
generated using server-sent events.
|
127
|
+
|
128
|
+
stream_options: Options for streaming response. Only set this when you set `stream: true`.
|
129
|
+
|
130
|
+
temperature: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
131
|
+
make the output more random, while lower values like 0.2 will make it more
|
132
|
+
focused and deterministic. We generally recommend altering this or `top_p` but
|
133
|
+
not both.
|
134
|
+
|
135
|
+
top_logprobs: An integer between 0 and 20 specifying the number of most likely tokens to
|
136
|
+
return at each token position, each with an associated log probability.
|
137
|
+
`logprobs` must be set to `true` if this parameter is used.
|
138
|
+
|
139
|
+
top_p: An alternative to sampling with temperature, called nucleus sampling, where the
|
140
|
+
model considers the results of the tokens with top_p probability mass. So 0.1
|
141
|
+
means only the tokens comprising the top 10% probability mass are considered.
|
142
|
+
|
143
|
+
We generally recommend altering this or `temperature` but not both.
|
144
|
+
|
145
|
+
user: A unique identifier representing your end-user, which can help DigitalOcean to
|
146
|
+
monitor and detect abuse.
|
147
|
+
|
148
|
+
extra_headers: Send extra headers
|
149
|
+
|
150
|
+
extra_query: Add additional query parameters to the request
|
151
|
+
|
152
|
+
extra_body: Add additional JSON properties to the request
|
153
|
+
|
154
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
155
|
+
"""
|
156
|
+
return self._post(
|
157
|
+
"/chat/completions"
|
158
|
+
if self._client._base_url_overridden
|
159
|
+
else "https://inference.do-ai.run/v1/chat/completions",
|
160
|
+
body=maybe_transform(
|
161
|
+
{
|
162
|
+
"messages": messages,
|
163
|
+
"model": model,
|
164
|
+
"frequency_penalty": frequency_penalty,
|
165
|
+
"logit_bias": logit_bias,
|
166
|
+
"logprobs": logprobs,
|
167
|
+
"max_completion_tokens": max_completion_tokens,
|
168
|
+
"max_tokens": max_tokens,
|
169
|
+
"metadata": metadata,
|
170
|
+
"n": n,
|
171
|
+
"presence_penalty": presence_penalty,
|
172
|
+
"stop": stop,
|
173
|
+
"stream": stream,
|
174
|
+
"stream_options": stream_options,
|
175
|
+
"temperature": temperature,
|
176
|
+
"top_logprobs": top_logprobs,
|
177
|
+
"top_p": top_p,
|
178
|
+
"user": user,
|
179
|
+
},
|
180
|
+
completion_create_params.CompletionCreateParams,
|
181
|
+
),
|
182
|
+
options=make_request_options(
|
183
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
184
|
+
),
|
185
|
+
cast_to=CompletionCreateResponse,
|
186
|
+
)
|
187
|
+
|
188
|
+
|
189
|
+
class AsyncCompletionsResource(AsyncAPIResource):
|
190
|
+
@cached_property
|
191
|
+
def with_raw_response(self) -> AsyncCompletionsResourceWithRawResponse:
|
192
|
+
"""
|
193
|
+
This property can be used as a prefix for any HTTP method call to return
|
194
|
+
the raw response object instead of the parsed content.
|
195
|
+
|
196
|
+
For more information, see https://www.github.com/digitalocean/gradientai-python#accessing-raw-response-data-eg-headers
|
197
|
+
"""
|
198
|
+
return AsyncCompletionsResourceWithRawResponse(self)
|
199
|
+
|
200
|
+
@cached_property
|
201
|
+
def with_streaming_response(self) -> AsyncCompletionsResourceWithStreamingResponse:
|
202
|
+
"""
|
203
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
204
|
+
|
205
|
+
For more information, see https://www.github.com/digitalocean/gradientai-python#with_streaming_response
|
206
|
+
"""
|
207
|
+
return AsyncCompletionsResourceWithStreamingResponse(self)
|
208
|
+
|
209
|
+
async def create(
|
210
|
+
self,
|
211
|
+
*,
|
212
|
+
messages: Iterable[completion_create_params.Message],
|
213
|
+
model: str,
|
214
|
+
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
|
215
|
+
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
|
216
|
+
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
|
217
|
+
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
|
218
|
+
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
|
219
|
+
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
220
|
+
n: Optional[int] | NotGiven = NOT_GIVEN,
|
221
|
+
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
|
222
|
+
stop: Union[Optional[str], List[str], None] | NotGiven = NOT_GIVEN,
|
223
|
+
stream: Optional[bool] | NotGiven = NOT_GIVEN,
|
224
|
+
stream_options: Optional[completion_create_params.StreamOptions] | NotGiven = NOT_GIVEN,
|
225
|
+
temperature: Optional[float] | NotGiven = NOT_GIVEN,
|
226
|
+
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
|
227
|
+
top_p: Optional[float] | NotGiven = NOT_GIVEN,
|
228
|
+
user: str | NotGiven = NOT_GIVEN,
|
229
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
230
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
231
|
+
extra_headers: Headers | None = None,
|
232
|
+
extra_query: Query | None = None,
|
233
|
+
extra_body: Body | None = None,
|
234
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
235
|
+
) -> CompletionCreateResponse:
|
236
|
+
"""
|
237
|
+
Creates a model response for the given chat conversation.
|
238
|
+
|
239
|
+
Args:
|
240
|
+
messages: A list of messages comprising the conversation so far.
|
241
|
+
|
242
|
+
model: Model ID used to generate the response.
|
243
|
+
|
244
|
+
frequency_penalty: Number between -2.0 and 2.0. Positive values penalize new tokens based on their
|
245
|
+
existing frequency in the text so far, decreasing the model's likelihood to
|
246
|
+
repeat the same line verbatim.
|
247
|
+
|
248
|
+
logit_bias: Modify the likelihood of specified tokens appearing in the completion.
|
249
|
+
|
250
|
+
Accepts a JSON object that maps tokens (specified by their token ID in the
|
251
|
+
tokenizer) to an associated bias value from -100 to 100. Mathematically, the
|
252
|
+
bias is added to the logits generated by the model prior to sampling. The exact
|
253
|
+
effect will vary per model, but values between -1 and 1 should decrease or
|
254
|
+
increase likelihood of selection; values like -100 or 100 should result in a ban
|
255
|
+
or exclusive selection of the relevant token.
|
256
|
+
|
257
|
+
logprobs: Whether to return log probabilities of the output tokens or not. If true,
|
258
|
+
returns the log probabilities of each output token returned in the `content` of
|
259
|
+
`message`.
|
260
|
+
|
261
|
+
max_completion_tokens: The maximum number of completion tokens that may be used over the course of the
|
262
|
+
run. The run will make a best effort to use only the number of completion tokens
|
263
|
+
specified, across multiple turns of the run.
|
264
|
+
|
265
|
+
max_tokens: The maximum number of tokens that can be generated in the completion.
|
266
|
+
|
267
|
+
The token count of your prompt plus `max_tokens` cannot exceed the model's
|
268
|
+
context length.
|
269
|
+
|
270
|
+
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
|
271
|
+
for storing additional information about the object in a structured format, and
|
272
|
+
querying for objects via API or the dashboard.
|
273
|
+
|
274
|
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
275
|
+
a maximum length of 512 characters.
|
276
|
+
|
277
|
+
n: How many chat completion choices to generate for each input message. Note that
|
278
|
+
you will be charged based on the number of generated tokens across all of the
|
279
|
+
choices. Keep `n` as `1` to minimize costs.
|
280
|
+
|
281
|
+
presence_penalty: Number between -2.0 and 2.0. Positive values penalize new tokens based on
|
282
|
+
whether they appear in the text so far, increasing the model's likelihood to
|
283
|
+
talk about new topics.
|
284
|
+
|
285
|
+
stop: Up to 4 sequences where the API will stop generating further tokens. The
|
286
|
+
returned text will not contain the stop sequence.
|
287
|
+
|
288
|
+
stream: If set to true, the model response data will be streamed to the client as it is
|
289
|
+
generated using server-sent events.
|
290
|
+
|
291
|
+
stream_options: Options for streaming response. Only set this when you set `stream: true`.
|
292
|
+
|
293
|
+
temperature: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
294
|
+
make the output more random, while lower values like 0.2 will make it more
|
295
|
+
focused and deterministic. We generally recommend altering this or `top_p` but
|
296
|
+
not both.
|
297
|
+
|
298
|
+
top_logprobs: An integer between 0 and 20 specifying the number of most likely tokens to
|
299
|
+
return at each token position, each with an associated log probability.
|
300
|
+
`logprobs` must be set to `true` if this parameter is used.
|
301
|
+
|
302
|
+
top_p: An alternative to sampling with temperature, called nucleus sampling, where the
|
303
|
+
model considers the results of the tokens with top_p probability mass. So 0.1
|
304
|
+
means only the tokens comprising the top 10% probability mass are considered.
|
305
|
+
|
306
|
+
We generally recommend altering this or `temperature` but not both.
|
307
|
+
|
308
|
+
user: A unique identifier representing your end-user, which can help DigitalOcean to
|
309
|
+
monitor and detect abuse.
|
310
|
+
|
311
|
+
extra_headers: Send extra headers
|
312
|
+
|
313
|
+
extra_query: Add additional query parameters to the request
|
314
|
+
|
315
|
+
extra_body: Add additional JSON properties to the request
|
316
|
+
|
317
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
318
|
+
"""
|
319
|
+
return await self._post(
|
320
|
+
"/chat/completions"
|
321
|
+
if self._client._base_url_overridden
|
322
|
+
else "https://inference.do-ai.run/v1/chat/completions",
|
323
|
+
body=await async_maybe_transform(
|
324
|
+
{
|
325
|
+
"messages": messages,
|
326
|
+
"model": model,
|
327
|
+
"frequency_penalty": frequency_penalty,
|
328
|
+
"logit_bias": logit_bias,
|
329
|
+
"logprobs": logprobs,
|
330
|
+
"max_completion_tokens": max_completion_tokens,
|
331
|
+
"max_tokens": max_tokens,
|
332
|
+
"metadata": metadata,
|
333
|
+
"n": n,
|
334
|
+
"presence_penalty": presence_penalty,
|
335
|
+
"stop": stop,
|
336
|
+
"stream": stream,
|
337
|
+
"stream_options": stream_options,
|
338
|
+
"temperature": temperature,
|
339
|
+
"top_logprobs": top_logprobs,
|
340
|
+
"top_p": top_p,
|
341
|
+
"user": user,
|
342
|
+
},
|
343
|
+
completion_create_params.CompletionCreateParams,
|
344
|
+
),
|
345
|
+
options=make_request_options(
|
346
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
347
|
+
),
|
348
|
+
cast_to=CompletionCreateResponse,
|
349
|
+
)
|
350
|
+
|
351
|
+
|
352
|
+
class CompletionsResourceWithRawResponse:
|
353
|
+
def __init__(self, completions: CompletionsResource) -> None:
|
354
|
+
self._completions = completions
|
355
|
+
|
356
|
+
self.create = to_raw_response_wrapper(
|
357
|
+
completions.create,
|
358
|
+
)
|
359
|
+
|
360
|
+
|
361
|
+
class AsyncCompletionsResourceWithRawResponse:
|
362
|
+
def __init__(self, completions: AsyncCompletionsResource) -> None:
|
363
|
+
self._completions = completions
|
364
|
+
|
365
|
+
self.create = async_to_raw_response_wrapper(
|
366
|
+
completions.create,
|
367
|
+
)
|
368
|
+
|
369
|
+
|
370
|
+
class CompletionsResourceWithStreamingResponse:
|
371
|
+
def __init__(self, completions: CompletionsResource) -> None:
|
372
|
+
self._completions = completions
|
373
|
+
|
374
|
+
self.create = to_streamed_response_wrapper(
|
375
|
+
completions.create,
|
376
|
+
)
|
377
|
+
|
378
|
+
|
379
|
+
class AsyncCompletionsResourceWithStreamingResponse:
|
380
|
+
def __init__(self, completions: AsyncCompletionsResource) -> None:
|
381
|
+
self._completions = completions
|
382
|
+
|
383
|
+
self.create = async_to_streamed_response_wrapper(
|
384
|
+
completions.create,
|
385
|
+
)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from .chat import (
|
4
|
+
ChatResource,
|
5
|
+
AsyncChatResource,
|
6
|
+
ChatResourceWithRawResponse,
|
7
|
+
AsyncChatResourceWithRawResponse,
|
8
|
+
ChatResourceWithStreamingResponse,
|
9
|
+
AsyncChatResourceWithStreamingResponse,
|
10
|
+
)
|
11
|
+
from .completions import (
|
12
|
+
CompletionsResource,
|
13
|
+
AsyncCompletionsResource,
|
14
|
+
CompletionsResourceWithRawResponse,
|
15
|
+
AsyncCompletionsResourceWithRawResponse,
|
16
|
+
CompletionsResourceWithStreamingResponse,
|
17
|
+
AsyncCompletionsResourceWithStreamingResponse,
|
18
|
+
)
|
19
|
+
|
20
|
+
__all__ = [
|
21
|
+
"CompletionsResource",
|
22
|
+
"AsyncCompletionsResource",
|
23
|
+
"CompletionsResourceWithRawResponse",
|
24
|
+
"AsyncCompletionsResourceWithRawResponse",
|
25
|
+
"CompletionsResourceWithStreamingResponse",
|
26
|
+
"AsyncCompletionsResourceWithStreamingResponse",
|
27
|
+
"ChatResource",
|
28
|
+
"AsyncChatResource",
|
29
|
+
"ChatResourceWithRawResponse",
|
30
|
+
"AsyncChatResourceWithRawResponse",
|
31
|
+
"ChatResourceWithStreamingResponse",
|
32
|
+
"AsyncChatResourceWithStreamingResponse",
|
33
|
+
]
|