mirror of
https://github.com/katanemo/plano.git
synced 2026-05-04 21:32:43 +02:00
Add support for json based content types in Message (#480)
This commit is contained in:
parent
f5e77bbe65
commit
218e9c540d
16 changed files with 314 additions and 121 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use crate::metrics::Metrics;
|
||||
use common::api::open_ai::{
|
||||
ChatCompletionStreamResponseServerEvents, ChatCompletionsRequest, ChatCompletionsResponse,
|
||||
Message, StreamOptions,
|
||||
ContentType, Message, StreamOptions,
|
||||
};
|
||||
use common::configuration::{LlmProvider, LlmProviderType, Overrides};
|
||||
use common::consts::{
|
||||
|
|
@ -369,7 +369,12 @@ impl HttpContext for StreamContext {
|
|||
.messages
|
||||
.iter()
|
||||
.fold(String::new(), |acc, m| {
|
||||
acc + " " + m.content.as_ref().unwrap_or(&String::new())
|
||||
acc + " "
|
||||
+ m.content
|
||||
.as_ref()
|
||||
.unwrap_or(&ContentType::Text(String::new()))
|
||||
.to_string()
|
||||
.as_str()
|
||||
});
|
||||
// enforce ratelimits on ingress
|
||||
if let Err(e) = self.enforce_ratelimits(&deserialized_body.model, input_tokens_str.as_str())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue