Skip to content

Commit

Permalink
. move internal value_ext to jc crate value-ext (for internal code only)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremychone committed Sep 4, 2024
1 parent 616c53b commit 43d4eb2
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 281 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ eventsource-stream = "0.2"
bytes = "1.6"
# -- Others
derive_more = { version = "1.0.0-beta", features = ["from", "display"] }
value-ext = "0.0.1" # JC Authored. Early release (API might change). Be cautious when using in other projects.
2 changes: 1 addition & 1 deletion src/adapter/adapters/anthropic/adapter_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ use crate::adapter::{Adapter, AdapterKind, ServiceType, WebRequestData};
use crate::chat::{
ChatOptionsSet, ChatRequest, ChatResponse, ChatRole, ChatStream, ChatStreamResponse, MessageContent, MetaUsage,
};
use crate::support::value_ext::ValueExt;
use crate::webc::WebResponse;
use crate::Result;
use crate::{ClientConfig, ModelIden};
use reqwest::RequestBuilder;
use reqwest_eventsource::EventSource;
use serde_json::{json, Value};
use value_ext::JsonValueExt;

pub struct AnthropicAdapter;

Expand Down
2 changes: 1 addition & 1 deletion src/adapter/adapters/anthropic/streamer.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::adapter::adapters::support::{StreamerCapturedData, StreamerOptions};
use crate::adapter::inter_stream::{InterStreamEnd, InterStreamEvent};
use crate::chat::{ChatOptionsSet, MetaUsage};
use crate::support::value_ext::ValueExt;
use crate::{Error, ModelIden, Result};
use reqwest_eventsource::{Event, EventSource};
use serde_json::Value;
use std::pin::Pin;
use std::task::{Context, Poll};
use value_ext::JsonValueExt;

pub struct AnthropicStreamer {
inner: EventSource,
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/adapters/cohere/adapter_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use crate::adapter::{Adapter, AdapterKind, ServiceType, WebRequestData};
use crate::chat::{
ChatOptionsSet, ChatRequest, ChatResponse, ChatRole, ChatStream, ChatStreamResponse, MessageContent, MetaUsage,
};
use crate::support::value_ext::ValueExt;
use crate::webc::{WebResponse, WebStream};
use crate::{ClientConfig, ModelIden};
use crate::{Error, Result};
use reqwest::RequestBuilder;
use serde_json::{json, Value};
use value_ext::JsonValueExt;

pub struct CohereAdapter;

Expand Down
2 changes: 1 addition & 1 deletion src/adapter/adapters/cohere/streamer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ use crate::adapter::adapters::support::{StreamerCapturedData, StreamerOptions};
use crate::adapter::cohere::CohereAdapter;
use crate::adapter::inter_stream::{InterStreamEnd, InterStreamEvent};
use crate::chat::ChatOptionsSet;
use crate::support::value_ext::ValueExt;
use crate::webc::WebStream;
use crate::{Error, ModelIden, Result};
use serde::Deserialize;
use serde_json::Value;
use std::pin::Pin;
use std::task::{Context, Poll};
use value_ext::JsonValueExt;

pub struct CohereStreamer {
inner: WebStream,
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/adapters/gemini/adapter_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use crate::adapter::{Adapter, AdapterKind, ServiceType, WebRequestData};
use crate::chat::{
ChatOptionsSet, ChatRequest, ChatResponse, ChatRole, ChatStream, ChatStreamResponse, MessageContent, MetaUsage,
};
use crate::support::value_ext::ValueExt;
use crate::webc::{WebResponse, WebStream};
use crate::{ClientConfig, ModelIden};
use crate::{Error, Result};
use reqwest::RequestBuilder;
use serde_json::{json, Value};
use value_ext::JsonValueExt;

pub struct GeminiAdapter;

Expand Down
2 changes: 1 addition & 1 deletion src/adapter/adapters/ollama/adapter_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
use crate::adapter::openai::OpenAIAdapter;
use crate::adapter::{Adapter, AdapterKind, ServiceType, WebRequestData};
use crate::chat::{ChatOptionsSet, ChatRequest, ChatResponse, ChatStreamResponse};
use crate::support::value_ext::ValueExt;
use crate::webc::WebResponse;
use crate::{ClientConfig, ModelIden};
use crate::{Error, Result};
use reqwest::RequestBuilder;
use serde_json::Value;
use value_ext::JsonValueExt;

pub struct OllamaAdapter;

Expand Down
2 changes: 1 addition & 1 deletion src/adapter/adapters/openai/adapter_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ use crate::chat::{
ChatOptionsSet, ChatRequest, ChatResponse, ChatResponseFormat, ChatRole, ChatStream, ChatStreamResponse,
MessageContent, MetaUsage,
};
use crate::support::value_ext::ValueExt;
use crate::webc::WebResponse;
use crate::{ClientConfig, ModelIden};
use crate::{Error, Result};
use reqwest::RequestBuilder;
use reqwest_eventsource::EventSource;
use serde_json::{json, Value};
use value_ext::JsonValueExt;

pub struct OpenAIAdapter;

Expand Down
2 changes: 1 addition & 1 deletion src/adapter/adapters/openai/streamer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ use crate::adapter::inter_stream::{InterStreamEnd, InterStreamEvent};
use crate::adapter::openai::OpenAIAdapter;
use crate::adapter::AdapterKind;
use crate::chat::ChatOptionsSet;
use crate::support::value_ext::ValueExt;
use crate::{Error, ModelIden, Result};
use reqwest_eventsource::{Event, EventSource};
use serde_json::Value;
use std::pin::Pin;
use std::task::{Context, Poll};
use value_ext::JsonValueExt;

pub struct OpenAIStreamer {
inner: EventSource,
Expand Down
5 changes: 3 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::adapter::AdapterKind;
use crate::chat::ChatRole;
use crate::{resolver, webc, ModelIden};
use derive_more::From;
use value_ext::JsonValueExtError;

pub type Result<T> = core::result::Result<T, Error>;

Expand Down Expand Up @@ -74,12 +75,12 @@ pub enum Error {
},

// -- Utils
#[from]
XValue(crate::support::value_ext::Error),

// -- Externals
#[from]
EventSourceClone(reqwest_eventsource::CannotCloneRequestError),
#[from]
JsonValueExt(JsonValueExtError),
ReqwestEventSource(reqwest_eventsource::Error),
}

Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// region: --- Modules

mod support;

mod client;
mod common;
mod error;
Expand Down
5 changes: 0 additions & 5 deletions src/support/mod.rs

This file was deleted.

Loading

0 comments on commit 43d4eb2

Please sign in to comment.