@@ -256,7 +256,6 @@ pub struct QueryResult {
256
256
257
257
pub struct Service {
258
258
content_endpoint : Option < String > ,
259
- api_key : String ,
260
259
path : PathBuf ,
261
260
vector_store : VectorStore ,
262
261
pending : Mutex < HashSet < String > > ,
@@ -370,16 +369,10 @@ impl Service {
370
369
s
371
370
}
372
371
373
- fn new < P : Into < PathBuf > > (
374
- path : P ,
375
- num_bufs : usize ,
376
- key : String ,
377
- content_endpoint : Option < String > ,
378
- ) -> Self {
372
+ fn new < P : Into < PathBuf > > ( path : P , num_bufs : usize , content_endpoint : Option < String > ) -> Self {
379
373
let path = path. into ( ) ;
380
374
Service {
381
375
content_endpoint,
382
- api_key : key,
383
376
path : path. clone ( ) ,
384
377
vector_store : VectorStore :: new ( path, num_bufs) ,
385
378
pending : Mutex :: new ( HashSet :: new ( ) ) ,
@@ -691,7 +684,7 @@ impl Service {
691
684
count : usize ,
692
685
) -> Result < Response < Body > , ResponseError > {
693
686
let api_key = api_key?;
694
- let vec = Box :: new ( ( embeddings_for ( & self . api_key , & [ q] ) . await . unwrap ( ) ) [ 0 ] ) ;
687
+ let vec = Box :: new ( ( embeddings_for ( & api_key, & [ q] ) . await . unwrap ( ) ) [ 0 ] ) ;
695
688
let qp = Point :: Mem { vec } ;
696
689
let index_id = create_index_name ( & domain, & commit) ;
697
690
// if None, then return 404
@@ -735,11 +728,10 @@ pub async fn serve<P: Into<PathBuf>>(
735
728
directory : P ,
736
729
port : u16 ,
737
730
num_bufs : usize ,
738
- key : String ,
739
731
content_endpoint : Option < String > ,
740
732
) -> Result < ( ) , Box < dyn std:: error:: Error + Send + Sync > > {
741
733
let addr = SocketAddr :: new ( IpAddr :: V6 ( Ipv6Addr :: UNSPECIFIED ) , port) ;
742
- let service = Arc :: new ( Service :: new ( directory, num_bufs, key , content_endpoint) ) ;
734
+ let service = Arc :: new ( Service :: new ( directory, num_bufs, content_endpoint) ) ;
743
735
let make_svc = make_service_fn ( move |_conn| {
744
736
let s = service. clone ( ) ;
745
737
async {
0 commit comments