forked from phoenix/litellm-mirror
bump version
This commit is contained in:
parent
9e808c0c1c
commit
5ec1fc5048
3 changed files with 27 additions and 3 deletions
|
@ -659,6 +659,14 @@ def completion(
|
||||||
chat_model = CodeChatModel.from_pretrained(model)
|
chat_model = CodeChatModel.from_pretrained(model)
|
||||||
|
|
||||||
chat = chat_model.start_chat()
|
chat = chat_model.start_chat()
|
||||||
|
|
||||||
|
if stream:
|
||||||
|
model_response = chat.send_message_streaming(prompt, **optional_params)
|
||||||
|
response = CustomStreamWrapper(
|
||||||
|
model_response, model, custom_llm_provider="vertexai", logging_obj=logging
|
||||||
|
)
|
||||||
|
return response
|
||||||
|
|
||||||
completion_response = chat.send_message(prompt, **optional_params)
|
completion_response = chat.send_message(prompt, **optional_params)
|
||||||
|
|
||||||
## LOGGING
|
## LOGGING
|
||||||
|
@ -692,6 +700,13 @@ def completion(
|
||||||
else:
|
else:
|
||||||
vertex_model = CodeGenerationModel.from_pretrained(model)
|
vertex_model = CodeGenerationModel.from_pretrained(model)
|
||||||
|
|
||||||
|
if stream:
|
||||||
|
model_response = vertex_model.predict_streaming(prompt, **optional_params)
|
||||||
|
response = CustomStreamWrapper(
|
||||||
|
model_response, model, custom_llm_provider="vertexai", logging_obj=logging
|
||||||
|
)
|
||||||
|
return response
|
||||||
|
|
||||||
completion_response = vertex_model.predict(prompt, **optional_params)
|
completion_response = vertex_model.predict(prompt, **optional_params)
|
||||||
|
|
||||||
## LOGGING
|
## LOGGING
|
||||||
|
|
|
@ -885,8 +885,8 @@ def get_optional_params( # use the openai defaults
|
||||||
if stop != None:
|
if stop != None:
|
||||||
optional_params["stop"] = stop #TG AI expects a list, example ["\n\n\n\n","<|endoftext|>"]
|
optional_params["stop"] = stop #TG AI expects a list, example ["\n\n\n\n","<|endoftext|>"]
|
||||||
elif (
|
elif (
|
||||||
model == "chat-bison"
|
model in litellm.vertex_chat_models or model in litellm.vertex_code_chat_models
|
||||||
): # chat-bison has diff args from chat-bison@001 ty Google
|
): # chat-bison has diff args from chat-bison@001, ty Google :)
|
||||||
if temperature != 1:
|
if temperature != 1:
|
||||||
optional_params["temperature"] = temperature
|
optional_params["temperature"] = temperature
|
||||||
if top_p != 1:
|
if top_p != 1:
|
||||||
|
@ -900,6 +900,12 @@ def get_optional_params( # use the openai defaults
|
||||||
optional_params["temperature"] = temperature
|
optional_params["temperature"] = temperature
|
||||||
optional_params["top_p"] = top_p
|
optional_params["top_p"] = top_p
|
||||||
optional_params["top_k"] = top_k
|
optional_params["top_k"] = top_k
|
||||||
|
if max_tokens != float("inf"):
|
||||||
|
optional_params["max_output_tokens"] = max_tokens
|
||||||
|
elif model in model in litellm.vertex_code_text_models:
|
||||||
|
optional_params["temperature"] = temperature
|
||||||
|
if max_tokens != float("inf"):
|
||||||
|
optional_params["max_output_tokens"] = max_tokens
|
||||||
elif custom_llm_provider == "baseten":
|
elif custom_llm_provider == "baseten":
|
||||||
optional_params["temperature"] = temperature
|
optional_params["temperature"] = temperature
|
||||||
optional_params["stream"] = stream
|
optional_params["stream"] = stream
|
||||||
|
@ -2482,6 +2488,9 @@ class CustomStreamWrapper:
|
||||||
elif self.model in litellm.nlp_cloud_models or self.custom_llm_provider == "nlp_cloud":
|
elif self.model in litellm.nlp_cloud_models or self.custom_llm_provider == "nlp_cloud":
|
||||||
chunk = next(self.completion_stream)
|
chunk = next(self.completion_stream)
|
||||||
completion_obj["content"] = self.handle_nlp_cloud_chunk(chunk)
|
completion_obj["content"] = self.handle_nlp_cloud_chunk(chunk)
|
||||||
|
elif self.model in (litellm.vertex_chat_models + litellm.vertex_code_chat_models + litellm.vertex_text_models + litellm.vertex_code_text_models):
|
||||||
|
chunk = next(self.completion_stream)
|
||||||
|
completion_obj["content"] = str(chunk)
|
||||||
elif self.model in litellm.cohere_models or self.custom_llm_provider == "cohere":
|
elif self.model in litellm.cohere_models or self.custom_llm_provider == "cohere":
|
||||||
chunk = next(self.completion_stream)
|
chunk = next(self.completion_stream)
|
||||||
completion_obj["content"] = self.handle_cohere_chunk(chunk)
|
completion_obj["content"] = self.handle_cohere_chunk(chunk)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "litellm"
|
name = "litellm"
|
||||||
version = "0.1.639"
|
version = "0.1.640"
|
||||||
description = "Library to easily interface with LLM API providers"
|
description = "Library to easily interface with LLM API providers"
|
||||||
authors = ["BerriAI"]
|
authors = ["BerriAI"]
|
||||||
license = "MIT License"
|
license = "MIT License"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue