-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Implemented Vector Search API. * Added a sanity test but disabled (Need to implement structure for automated testing).
- Loading branch information
Showing
25 changed files
with
722 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// CBLPrediction.h | ||
// | ||
// Copyright (c) 2024 Couchbase, Inc All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#pragma once | ||
#include "CBLBase.h" | ||
|
||
#ifdef COUCHBASE_ENTERPRISE | ||
|
||
CBL_CAPI_BEGIN | ||
|
||
/** Predictive Model */ | ||
typedef struct { | ||
/** A pointer to any external data needed by the `prediction` callback, which will receive this as its first parameter. */ | ||
void* _cbl_nullable context; | ||
|
||
/** Called from within a query (or document indexing) to run the prediction. | ||
@param context The value of the CBLPredictiveModel's `context` field. | ||
@param input The input dictionary from the query. | ||
@return The output dictionary of the prediction function or NULL if there is no output. | ||
@note The output dictionary will be automatically released after it's being consumed. | ||
@warning This function must be "pure": given the same input parameters it must always | ||
produce the same output (otherwise indexes or queries may be messed up). | ||
It MUST NOT alter the database or any documents, nor run a query: either of | ||
those are very likely to cause a crash. */ | ||
FLDict _cbl_nullable (* _cbl_nonnull prediction)(void* _cbl_nullable context, FLDict input); | ||
|
||
/** Called if the model is unregistered, so it can release resources. */ | ||
void (*_cbl_nullable unregistered)(void* context); | ||
} CBLPredictiveModel; | ||
|
||
void CBL_RegisterPredictiveModel(FLString name, CBLPredictiveModel model) CBLAPI; | ||
|
||
void CBL_UnregisterPredictiveModel(FLString name) CBLAPI; | ||
|
||
CBL_CAPI_END | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.