Skip to content

Commit

Permalink
🌿 Fern Regeneration -- June 10, 2024 (#524)
Browse files Browse the repository at this point in the history
* SDK regeneration

* Restore

* Fix deps

---------

Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
Co-authored-by: Billy Trend <[email protected]>
  • Loading branch information
fern-api[bot] and billytrend-cohere authored Jun 11, 2024
1 parent 8f5ff50 commit 0fc77bc
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ src/cohere/utils.py
src/cohere/overrides.py
src/cohere/config.py
src/cohere/manually_maintained
src/cohere/bedrock_client.py
src/cohere/bedrock_client.py
src/cohere/aws_client.py
src/cohere/sagemaker_client.py
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.5.6"
version = "5.5.7"
description = ""
readme = "README.md"
authors = []
Expand Down
6 changes: 6 additions & 0 deletions src/cohere/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
ChatStreamRequestPromptTruncation,
ChatStreamStartEvent,
ChatTextGenerationEvent,
ChatToolCallsChunkEvent,
ChatToolCallsGenerationEvent,
CheckApiKeyResponse,
ClassifyDataMetrics,
Expand Down Expand Up @@ -112,6 +113,7 @@
StreamedChatResponse_StreamEnd,
StreamedChatResponse_StreamStart,
StreamedChatResponse_TextGeneration,
StreamedChatResponse_ToolCallsChunk,
StreamedChatResponse_ToolCallsGeneration,
SummarizeRequestExtractiveness,
SummarizeRequestFormat,
Expand All @@ -121,6 +123,7 @@
TooManyRequestsErrorBody,
Tool,
ToolCall,
ToolCallDelta,
ToolMessage,
ToolParameterDefinitionsValue,
ToolResult,
Expand Down Expand Up @@ -183,6 +186,7 @@
"ChatStreamRequestPromptTruncation",
"ChatStreamStartEvent",
"ChatTextGenerationEvent",
"ChatToolCallsChunkEvent",
"ChatToolCallsGenerationEvent",
"CheckApiKeyResponse",
"ClassifyDataMetrics",
Expand Down Expand Up @@ -280,6 +284,7 @@
"StreamedChatResponse_StreamEnd",
"StreamedChatResponse_StreamStart",
"StreamedChatResponse_TextGeneration",
"StreamedChatResponse_ToolCallsChunk",
"StreamedChatResponse_ToolCallsGeneration",
"SummarizeRequestExtractiveness",
"SummarizeRequestFormat",
Expand All @@ -290,6 +295,7 @@
"TooManyRequestsErrorBody",
"Tool",
"ToolCall",
"ToolCallDelta",
"ToolMessage",
"ToolParameterDefinitionsValue",
"ToolResult",
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 @@ -25,7 +25,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.5.6",
"X-Fern-SDK-Version": "5.5.7",
}
if self._client_name is not None:
headers["X-Client-Name"] = self._client_name
Expand Down
6 changes: 6 additions & 0 deletions src/cohere/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .chat_stream_request_prompt_truncation import ChatStreamRequestPromptTruncation
from .chat_stream_start_event import ChatStreamStartEvent
from .chat_text_generation_event import ChatTextGenerationEvent
from .chat_tool_calls_chunk_event import ChatToolCallsChunkEvent
from .chat_tool_calls_generation_event import ChatToolCallsGenerationEvent
from .check_api_key_response import CheckApiKeyResponse
from .classify_data_metrics import ClassifyDataMetrics
Expand Down Expand Up @@ -110,6 +111,7 @@
StreamedChatResponse_StreamEnd,
StreamedChatResponse_StreamStart,
StreamedChatResponse_TextGeneration,
StreamedChatResponse_ToolCallsChunk,
StreamedChatResponse_ToolCallsGeneration,
)
from .summarize_request_extractiveness import SummarizeRequestExtractiveness
Expand All @@ -120,6 +122,7 @@
from .too_many_requests_error_body import TooManyRequestsErrorBody
from .tool import Tool
from .tool_call import ToolCall
from .tool_call_delta import ToolCallDelta
from .tool_message import ToolMessage
from .tool_parameter_definitions_value import ToolParameterDefinitionsValue
from .tool_result import ToolResult
Expand Down Expand Up @@ -153,6 +156,7 @@
"ChatStreamRequestPromptTruncation",
"ChatStreamStartEvent",
"ChatTextGenerationEvent",
"ChatToolCallsChunkEvent",
"ChatToolCallsGenerationEvent",
"CheckApiKeyResponse",
"ClassifyDataMetrics",
Expand Down Expand Up @@ -237,6 +241,7 @@
"StreamedChatResponse_StreamEnd",
"StreamedChatResponse_StreamStart",
"StreamedChatResponse_TextGeneration",
"StreamedChatResponse_ToolCallsChunk",
"StreamedChatResponse_ToolCallsGeneration",
"SummarizeRequestExtractiveness",
"SummarizeRequestFormat",
Expand All @@ -246,6 +251,7 @@
"TooManyRequestsErrorBody",
"Tool",
"ToolCall",
"ToolCallDelta",
"ToolMessage",
"ToolParameterDefinitionsValue",
"ToolResult",
Expand Down
33 changes: 33 additions & 0 deletions src/cohere/types/chat_tool_calls_chunk_event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

from ..core.datetime_utils import serialize_datetime
from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
from .chat_stream_event import ChatStreamEvent
from .tool_call_delta import ToolCallDelta


class ChatToolCallsChunkEvent(ChatStreamEvent):
tool_call_delta: ToolCallDelta

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
return super().json(**kwargs_with_defaults)

def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}

return deep_union_pydantic_dicts(
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
)

class Config:
frozen = True
smart_union = True
allow_population_by_field_name = True
populate_by_name = True
extra = pydantic_v1.Extra.allow
json_encoders = {dt.datetime: serialize_datetime}
5 changes: 5 additions & 0 deletions src/cohere/types/chat_tool_calls_generation_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@


class ChatToolCallsGenerationEvent(ChatStreamEvent):
text: typing.Optional[str] = pydantic_v1.Field(default=None)
"""
The text generated related to the tool calls generated
"""

tool_calls: typing.List[ToolCall]

def json(self, **kwargs: typing.Any) -> str:
Expand Down
30 changes: 30 additions & 0 deletions src/cohere/types/streamed_chat_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .chat_stream_end_event_finish_reason import ChatStreamEndEventFinishReason
from .non_streamed_chat_response import NonStreamedChatResponse
from .tool_call import ToolCall
from .tool_call_delta import ToolCallDelta


class StreamedChatResponse_StreamStart(UncheckedBaseModel):
Expand Down Expand Up @@ -160,6 +161,7 @@ class StreamedChatResponse_ToolCallsGeneration(UncheckedBaseModel):
StreamedChatResponse is returned in streaming mode (specified with `stream=True` in the request).
"""

text: typing.Optional[str] = None
tool_calls: typing.List[ToolCall]
event_type: typing.Literal["tool-calls-generation"] = "tool-calls-generation"

Expand Down Expand Up @@ -210,6 +212,33 @@ class Config:
json_encoders = {dt.datetime: serialize_datetime}


class StreamedChatResponse_ToolCallsChunk(UncheckedBaseModel):
"""
StreamedChatResponse is returned in streaming mode (specified with `stream=True` in the request).
"""

tool_call_delta: ToolCallDelta
event_type: typing.Literal["tool-calls-chunk"] = "tool-calls-chunk"

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
return super().json(**kwargs_with_defaults)

def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}

return deep_union_pydantic_dicts(
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
)

class Config:
frozen = True
smart_union = True
extra = pydantic_v1.Extra.allow
json_encoders = {dt.datetime: serialize_datetime}


StreamedChatResponse = typing_extensions.Annotated[
typing.Union[
StreamedChatResponse_StreamStart,
Expand All @@ -219,6 +248,7 @@ class Config:
StreamedChatResponse_CitationGeneration,
StreamedChatResponse_ToolCallsGeneration,
StreamedChatResponse_StreamEnd,
StreamedChatResponse_ToolCallsChunk,
],
UnionMetadata(discriminant="event_type"),
]
47 changes: 47 additions & 0 deletions src/cohere/types/tool_call_delta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

from ..core.datetime_utils import serialize_datetime
from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
from ..core.unchecked_base_model import UncheckedBaseModel


class ToolCallDelta(UncheckedBaseModel):
"""
Contains the chunk of the tool call generation in the stream.
"""

name: typing.Optional[str] = pydantic_v1.Field(default=None)
"""
Name of the tool call
"""

index: typing.Optional[float] = pydantic_v1.Field(default=None)
"""
Index of the tool call generated
"""

parameters: typing.Optional[str] = pydantic_v1.Field(default=None)
"""
Chunk of the tool parameters
"""

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
return super().json(**kwargs_with_defaults)

def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}

return deep_union_pydantic_dicts(
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
)

class Config:
frozen = True
smart_union = True
extra = pydantic_v1.Extra.allow
json_encoders = {dt.datetime: serialize_datetime}

0 comments on commit 0fc77bc

Please sign in to comment.