Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Feb 29, 2024
1 parent 165ba6c commit 57c1855
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 90 deletions.
18 changes: 9 additions & 9 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cohere"
version = "5.0.0a7"
version = "5.0.0a8"
description = ""
readme = "README.md"
authors = []
Expand Down
8 changes: 2 additions & 6 deletions src/cohere/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,8 @@
SummarizeResponse,
TokenizeResponse,
Tool,
ToolDefinition,
ToolDefinitionInputsItem,
ToolDefinitionOutputsItem,
ToolInput,
ToolParameterDefinitionsValue,
UpdateConnectorResponse,
)
from .errors import BadRequestError, ForbiddenError, InternalServerError, NotFoundError, TooManyRequestsError
Expand Down Expand Up @@ -252,10 +250,8 @@
"TokenizeResponse",
"TooManyRequestsError",
"Tool",
"ToolDefinition",
"ToolDefinitionInputsItem",
"ToolDefinitionOutputsItem",
"ToolInput",
"ToolParameterDefinitionsValue",
"UpdateConnectorResponse",
"connectors",
"datasets",
Expand Down
20 changes: 20 additions & 0 deletions src/cohere/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def chat_stream(
p: typing.Optional[float] = OMIT,
frequency_penalty: typing.Optional[float] = OMIT,
presence_penalty: typing.Optional[float] = OMIT,
raw_prompting: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.Iterator[StreamedChatResponse]:
"""
Expand Down Expand Up @@ -204,6 +205,8 @@ def chat_stream(
Used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
- raw_prompting: typing.Optional[bool]. When enabled, the user's prompt will be sent to the model without any pre-processing.
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
"""
_request: typing.Dict[str, typing.Any] = {"message": message, "stream": True}
Expand Down Expand Up @@ -235,6 +238,8 @@ def chat_stream(
_request["frequency_penalty"] = frequency_penalty
if presence_penalty is not OMIT:
_request["presence_penalty"] = presence_penalty
if raw_prompting is not OMIT:
_request["raw_prompting"] = raw_prompting
with self._client_wrapper.httpx_client.stream(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "chat"),
Expand Down Expand Up @@ -292,6 +297,7 @@ def chat(
p: typing.Optional[float] = OMIT,
frequency_penalty: typing.Optional[float] = OMIT,
presence_penalty: typing.Optional[float] = OMIT,
raw_prompting: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> NonStreamedChatResponse:
"""
Expand Down Expand Up @@ -369,6 +375,8 @@ def chat(
Used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
- raw_prompting: typing.Optional[bool]. When enabled, the user's prompt will be sent to the model without any pre-processing.
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
---
from cohere import ChatMessage, ChatMessageRole, ChatRequestPromptTruncation
Expand Down Expand Up @@ -427,6 +435,8 @@ def chat(
_request["frequency_penalty"] = frequency_penalty
if presence_penalty is not OMIT:
_request["presence_penalty"] = presence_penalty
if raw_prompting is not OMIT:
_request["raw_prompting"] = raw_prompting
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "chat"),
Expand Down Expand Up @@ -1368,6 +1378,7 @@ async def chat_stream(
p: typing.Optional[float] = OMIT,
frequency_penalty: typing.Optional[float] = OMIT,
presence_penalty: typing.Optional[float] = OMIT,
raw_prompting: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.AsyncIterator[StreamedChatResponse]:
"""
Expand Down Expand Up @@ -1445,6 +1456,8 @@ async def chat_stream(
Used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
- raw_prompting: typing.Optional[bool]. When enabled, the user's prompt will be sent to the model without any pre-processing.
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
"""
_request: typing.Dict[str, typing.Any] = {"message": message, "stream": True}
Expand Down Expand Up @@ -1476,6 +1489,8 @@ async def chat_stream(
_request["frequency_penalty"] = frequency_penalty
if presence_penalty is not OMIT:
_request["presence_penalty"] = presence_penalty
if raw_prompting is not OMIT:
_request["raw_prompting"] = raw_prompting
async with self._client_wrapper.httpx_client.stream(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "chat"),
Expand Down Expand Up @@ -1533,6 +1548,7 @@ async def chat(
p: typing.Optional[float] = OMIT,
frequency_penalty: typing.Optional[float] = OMIT,
presence_penalty: typing.Optional[float] = OMIT,
raw_prompting: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> NonStreamedChatResponse:
"""
Expand Down Expand Up @@ -1610,6 +1626,8 @@ async def chat(
Used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
- raw_prompting: typing.Optional[bool]. When enabled, the user's prompt will be sent to the model without any pre-processing.
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
---
from cohere import ChatMessage, ChatMessageRole, ChatRequestPromptTruncation
Expand Down Expand Up @@ -1668,6 +1686,8 @@ async def chat(
_request["frequency_penalty"] = frequency_penalty
if presence_penalty is not OMIT:
_request["presence_penalty"] = presence_penalty
if raw_prompting is not OMIT:
_request["raw_prompting"] = raw_prompting
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "chat"),
Expand Down
2 changes: 1 addition & 1 deletion src/cohere/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "cohere",
"X-Fern-SDK-Version": "5.0.0a7",
"X-Fern-SDK-Version": "5.0.0a8",
}
if self._client_name is not None:
headers["X-Client-Name"] = self._client_name
Expand Down
8 changes: 2 additions & 6 deletions src/cohere/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,8 @@
from .summarize_response import SummarizeResponse
from .tokenize_response import TokenizeResponse
from .tool import Tool
from .tool_definition import ToolDefinition
from .tool_definition_inputs_item import ToolDefinitionInputsItem
from .tool_definition_outputs_item import ToolDefinitionOutputsItem
from .tool_input import ToolInput
from .tool_parameter_definitions_value import ToolParameterDefinitionsValue
from .update_connector_response import UpdateConnectorResponse

__all__ = [
Expand Down Expand Up @@ -227,9 +225,7 @@
"SummarizeResponse",
"TokenizeResponse",
"Tool",
"ToolDefinition",
"ToolDefinitionInputsItem",
"ToolDefinitionOutputsItem",
"ToolInput",
"ToolParameterDefinitionsValue",
"UpdateConnectorResponse",
]
5 changes: 3 additions & 2 deletions src/cohere/types/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import typing

from ..core.datetime_utils import serialize_datetime
from .tool_definition import ToolDefinition
from .tool_parameter_definitions_value import ToolParameterDefinitionsValue

try:
import pydantic.v1 as pydantic # type: ignore
Expand All @@ -14,7 +14,8 @@

class Tool(pydantic.BaseModel):
name: str
definition: typing.Optional[ToolDefinition] = None
description: str
parameter_definitions: typing.Optional[typing.Dict[str, ToolParameterDefinitionsValue]] = None

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
Expand Down
32 changes: 0 additions & 32 deletions src/cohere/types/tool_definition.py

This file was deleted.

31 changes: 0 additions & 31 deletions src/cohere/types/tool_definition_outputs_item.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
import pydantic # type: ignore


class ToolDefinitionInputsItem(pydantic.BaseModel):
name: str
class ToolParameterDefinitionsValue(pydantic.BaseModel):
description: str
type: str
required: typing.Optional[bool] = None
Expand Down

0 comments on commit 57c1855

Please sign in to comment.