|
16 | 16 | from openai.types.chat import ( |
17 | 17 | ChatCompletionMessage, |
18 | 18 | ChatCompletionMessageParam, |
| 19 | + ChatCompletionToolChoiceOptionParam, |
| 20 | + ChatCompletionToolParam, |
19 | 21 | completion_create_params, |
20 | 22 | ) |
21 | 23 | from openai.types.chat.chat_completion import ChatCompletion, Choice |
@@ -55,7 +57,24 @@ def get_models(self) -> set[str]: |
55 | 57 | def is_model_supported(self, model: str) -> bool: |
56 | 58 | return model in self.get_models() |
57 | 59 |
|
58 | | - def is_prompt_supported(self, messages: Iterable[ChatCompletionMessageParam], model: str) -> int: |
| 60 | + def is_prompt_supported( |
| 61 | + self, |
| 62 | + messages: Iterable[ChatCompletionMessageParam], |
| 63 | + model: str, |
| 64 | + frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN, |
| 65 | + logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN, |
| 66 | + logprobs: Optional[bool] | NotGiven = NOT_GIVEN, |
| 67 | + max_tokens: Optional[int] | NotGiven = NOT_GIVEN, |
| 68 | + n: Optional[int] | NotGiven = NOT_GIVEN, |
| 69 | + presence_penalty: Optional[float] | NotGiven = NOT_GIVEN, |
| 70 | + response_format: dict | completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN, |
| 71 | + stop: Union[Optional[str], List[str]] | NotGiven = NOT_GIVEN, |
| 72 | + temperature: Optional[float] | NotGiven = NOT_GIVEN, |
| 73 | + tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN, |
| 74 | + tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN, |
| 75 | + top_logprobs: Optional[int] | NotGiven = NOT_GIVEN, |
| 76 | + top_p: Optional[float] | NotGiven = NOT_GIVEN, |
| 77 | + ) -> int: |
59 | 78 | system, chat = self.__openai_messages_to_google_messages(messages) |
60 | 79 | gen_model = generativeai.GenerativeModel(model_name=model, system_instruction=system) |
61 | 80 | try: |
@@ -96,9 +115,11 @@ def chat_completion( |
96 | 115 | max_tokens: Optional[int] | NotGiven = NOT_GIVEN, |
97 | 116 | n: Optional[int] | NotGiven = NOT_GIVEN, |
98 | 117 | presence_penalty: Optional[float] | NotGiven = NOT_GIVEN, |
99 | | - response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN, |
| 118 | + response_format: str | completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN, |
100 | 119 | stop: Union[Optional[str], List[str]] | NotGiven = NOT_GIVEN, |
101 | 120 | temperature: Optional[float] | NotGiven = NOT_GIVEN, |
| 121 | + tools: Iterable[ChatCompletionToolParam] | NotGiven = NOT_GIVEN, |
| 122 | + tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven = NOT_GIVEN, |
102 | 123 | top_logprobs: Optional[int] | NotGiven = NOT_GIVEN, |
103 | 124 | top_p: Optional[float] | NotGiven = NOT_GIVEN, |
104 | 125 | ) -> ChatCompletion: |
|
0 commit comments