diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6b7b74c5..da59f99e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.3.0" + ".": "0.4.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index a8e67cf3..3bf9ffe6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 46 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-5298551c424bb999f258bdd6c311e96c80c70701ad59bbce19b46c788ee13bd4.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-f43814080090927ee22816c5c7f517d8a7eb7f346329ada67915608e32124321.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 28b8302a..3273f3a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 0.4.0 (2025-03-03) + +Full Changelog: [v0.3.0...v0.4.0](https://github.com/ContextualAI/contextual-client-python/compare/v0.3.0...v0.4.0) + +### Features + +* Add special snowflake path for internal dns usage ([#52](https://github.com/ContextualAI/contextual-client-python/issues/52)) ([dd0ea41](https://github.com/ContextualAI/contextual-client-python/commit/dd0ea4117c37eb53620304a30f736747f30f6ce6)) +* **api:** update via SDK Studio ([#59](https://github.com/ContextualAI/contextual-client-python/issues/59)) ([9b116a4](https://github.com/ContextualAI/contextual-client-python/commit/9b116a4e1d935a32ab8a44a36042891edf4d2125)) + + +### Chores + +* **docs:** update client docstring ([#55](https://github.com/ContextualAI/contextual-client-python/issues/55)) ([ef1ee6e](https://github.com/ContextualAI/contextual-client-python/commit/ef1ee6e351e2c1a84af871f70742045df23fbe7f)) + + +### Documentation + +* update URLs from stainlessapi.com to stainless.com ([#53](https://github.com/ContextualAI/contextual-client-python/issues/53)) ([4162888](https://github.com/ContextualAI/contextual-client-python/commit/41628880bfb7d72cb3759ea06f1c09c11bb60e1a)) + ## 0.3.0 (2025-02-26) Full Changelog: [v0.2.0...v0.3.0](https://github.com/ContextualAI/contextual-client-python/compare/v0.2.0...v0.3.0) diff --git a/SECURITY.md b/SECURITY.md index b8c93805..92a473ff 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,9 +2,9 @@ ## Reporting Security Issues -This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. +This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. -To report a security issue, please contact the Stainless team at security@stainlessapi.com. +To report a security issue, please contact the Stainless team at security@stainless.com. ## Responsible Disclosure diff --git a/pyproject.toml b/pyproject.toml index cc47bce2..cd4ac761 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "contextual-client" -version = "0.3.0" +version = "0.4.0" description = "The official Python library for the Contextual AI API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/contextual/_client.py b/src/contextual/_client.py index dd5ae9e3..820e0f04 100644 --- a/src/contextual/_client.py +++ b/src/contextual/_client.py @@ -85,7 +85,7 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new synchronous Contextual AI client instance. + """Construct a new synchronous ContextualAI client instance. This automatically infers the `api_key` argument from the `CONTEXTUAL_API_KEY` environment variable if it is not provided. """ @@ -276,7 +276,7 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new async Contextual AI client instance. + """Construct a new async AsyncContextualAI client instance. This automatically infers the `api_key` argument from the `CONTEXTUAL_API_KEY` environment variable if it is not provided. """ diff --git a/src/contextual/_version.py b/src/contextual/_version.py index 4511fdb6..da82a52b 100644 --- a/src/contextual/_version.py +++ b/src/contextual/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "contextual" -__version__ = "0.3.0" # x-release-please-version +__version__ = "0.4.0" # x-release-please-version diff --git a/src/contextual/resources/generate.py b/src/contextual/resources/generate.py index 8d044f1e..0e879a9c 100644 --- a/src/contextual/resources/generate.py +++ b/src/contextual/resources/generate.py @@ -53,7 +53,10 @@ def create( messages: Iterable[generate_create_params.Message], model: str, avoid_commentary: bool | NotGiven = NOT_GIVEN, + max_new_tokens: int | NotGiven = NOT_GIVEN, system_prompt: str | NotGiven = NOT_GIVEN, + temperature: float | NotGiven = NOT_GIVEN, + top_p: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -83,9 +86,18 @@ def create( context. However, commentary may provide useful context which improves the helpfulness of responses. + max_new_tokens: The maximum number of tokens that the model can generate in the response. + system_prompt: Instructions that the model follows when generating responses. Note that we do not guarantee that the model follows these instructions exactly. + temperature: The sampling temperature, which affects the randomness in the response. Note + that higher temperature values can reduce groundedness + + top_p: A parameter for nucleus sampling, an alternative to temperature which also + affects the randomness of the response. Note that higher top_p values can reduce + groundedness + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -102,7 +114,10 @@ def create( "messages": messages, "model": model, "avoid_commentary": avoid_commentary, + "max_new_tokens": max_new_tokens, "system_prompt": system_prompt, + "temperature": temperature, + "top_p": top_p, }, generate_create_params.GenerateCreateParams, ), @@ -140,7 +155,10 @@ async def create( messages: Iterable[generate_create_params.Message], model: str, avoid_commentary: bool | NotGiven = NOT_GIVEN, + max_new_tokens: int | NotGiven = NOT_GIVEN, system_prompt: str | NotGiven = NOT_GIVEN, + temperature: float | NotGiven = NOT_GIVEN, + top_p: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -170,9 +188,18 @@ async def create( context. However, commentary may provide useful context which improves the helpfulness of responses. + max_new_tokens: The maximum number of tokens that the model can generate in the response. + system_prompt: Instructions that the model follows when generating responses. Note that we do not guarantee that the model follows these instructions exactly. + temperature: The sampling temperature, which affects the randomness in the response. Note + that higher temperature values can reduce groundedness + + top_p: A parameter for nucleus sampling, an alternative to temperature which also + affects the randomness of the response. Note that higher top_p values can reduce + groundedness + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -189,7 +216,10 @@ async def create( "messages": messages, "model": model, "avoid_commentary": avoid_commentary, + "max_new_tokens": max_new_tokens, "system_prompt": system_prompt, + "temperature": temperature, + "top_p": top_p, }, generate_create_params.GenerateCreateParams, ), diff --git a/src/contextual/types/agents/evaluate/list_evaluation_jobs_response.py b/src/contextual/types/agents/evaluate/list_evaluation_jobs_response.py index 24038c29..15477f04 100644 --- a/src/contextual/types/agents/evaluate/list_evaluation_jobs_response.py +++ b/src/contextual/types/agents/evaluate/list_evaluation_jobs_response.py @@ -31,6 +31,9 @@ class EvaluationRound(BaseModel): num_predictions: Optional[int] = None """Total number of predictions made during the evaluation round""" + num_processed_predictions: Optional[int] = None + """Number of predictions that have been processed during the evaluation round""" + num_successful_predictions: Optional[int] = None """Number of predictions that were successful during the evaluation round""" diff --git a/src/contextual/types/generate_create_params.py b/src/contextual/types/generate_create_params.py index c0cd4658..cea58b2f 100644 --- a/src/contextual/types/generate_create_params.py +++ b/src/contextual/types/generate_create_params.py @@ -30,16 +30,32 @@ class GenerateCreateParams(TypedDict, total=False): helpfulness of responses. """ + max_new_tokens: int + """The maximum number of tokens that the model can generate in the response.""" + system_prompt: str """Instructions that the model follows when generating responses. Note that we do not guarantee that the model follows these instructions exactly. """ + temperature: float + """The sampling temperature, which affects the randomness in the response. + + Note that higher temperature values can reduce groundedness + """ + + top_p: float + """ + A parameter for nucleus sampling, an alternative to temperature which also + affects the randomness of the response. Note that higher top_p values can reduce + groundedness + """ + class Message(TypedDict, total=False): content: Required[str] """Content of the message""" - role: Required[Literal["user", "system", "assistant", "knowledge"]] + role: Required[Literal["user", "assistant"]] """Role of the sender""" diff --git a/src/contextual_sdk/lib/.keep b/src/contextual_sdk/lib/.keep deleted file mode 100644 index 5e2c99fd..00000000 --- a/src/contextual_sdk/lib/.keep +++ /dev/null @@ -1,4 +0,0 @@ -File generated from our OpenAPI spec by Stainless. - -This directory can be used to store custom files to expand the SDK. -It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/src/sunrise/lib/.keep b/src/sunrise/lib/.keep deleted file mode 100644 index 5e2c99fd..00000000 --- a/src/sunrise/lib/.keep +++ /dev/null @@ -1,4 +0,0 @@ -File generated from our OpenAPI spec by Stainless. - -This directory can be used to store custom files to expand the SDK. -It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/tests/api_resources/test_generate.py b/tests/api_resources/test_generate.py index 2a379f22..44938ae2 100644 --- a/tests/api_resources/test_generate.py +++ b/tests/api_resources/test_generate.py @@ -43,7 +43,10 @@ def test_method_create_with_all_params(self, client: ContextualAI) -> None: ], model="model", avoid_commentary=True, + max_new_tokens=1, system_prompt="system_prompt", + temperature=0, + top_p=1, ) assert_matches_type(GenerateCreateResponse, generate, path=["response"]) @@ -115,7 +118,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncContextual ], model="model", avoid_commentary=True, + max_new_tokens=1, system_prompt="system_prompt", + temperature=0, + top_p=1, ) assert_matches_type(GenerateCreateResponse, generate, path=["response"])