feat(clients): xai platform: voice, files, collections, management API, key info
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
// POST /v1/documents/search on api.x.ai (XAI_API_KEY): semantic, keyword or
|
||||
// hybrid search over one or more collections.
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "xai/platform/platform_service.h"
|
||||
|
||||
namespace molo::xai::platform {
|
||||
|
||||
struct DocumentSearchRequest {
|
||||
std::string query; // required
|
||||
std::vector<std::string> collection_ids; // 1..kMaxCollectionIds
|
||||
std::string rag_pipeline; // "" | chroma_db | es
|
||||
std::string filter; // AIP-160 metadata filter
|
||||
std::string instructions;
|
||||
int limit = 0; // 0 = server default
|
||||
std::string ranking_metric; // "" | RANKING_METRIC_L2_DISTANCE | ..._COSINE_SIMILARITY
|
||||
std::string retrieval_mode; // "" | hybrid | semantic | keyword
|
||||
Json retrieval_options; // extra keys merged into retrieval_mode (reranker, search_multiplier)
|
||||
Json group_by; // null or {keys:[...], aggregate:{min_k|max_k:{k,keys}}}
|
||||
};
|
||||
|
||||
class DocumentSearch : public PlatformService {
|
||||
public:
|
||||
explicit DocumentSearch(std::shared_ptr<llm::ApiClient> api)
|
||||
: PlatformService(std::move(api), Host::kApi) {}
|
||||
|
||||
// Request body exactly as sent; throws on invalid input.
|
||||
Json build(const DocumentSearchRequest& request) const;
|
||||
// Returns {matches:[{file_id, chunk_id, chunk_content, score, collection_ids, fields, page_number?}]}.
|
||||
Json search(const DocumentSearchRequest& request);
|
||||
};
|
||||
|
||||
} // namespace molo::xai::platform
|
||||
Reference in New Issue
Block a user