Skip to content

bug: type mismatch on SurrealDB integration #1644

@fu050409

Description

@fu050409
  • I have looked for existing issues (including closed) about this

Bug Report

type mismatch resolving <SurrealSearchFilter as SearchFilter>::Value == Value
surrealdb::surrealdb_types::Value and serde_json::value::Value have similar names, but are actually distinct types
required for SurrealVectorStore<Db, rig::providers::openai::EmbeddingModel> to implement VectorStoreIndexDyn

Reproduction

let base_url = std::env::var("OPENAI_BASE_URL").expect("OPENAI_BASE_URL not set");
let key = std::env::var("OPENAI_API_KEY").expect("OPENAI_API_KEY not set");
let client = openai::Client::builder()
    .api_key(key)
    .base_url(base_url)
    .build()
    .unwrap();
let model = client.embedding_model(MINIMAX_M2);
let db = surrealdb::Surreal::new::<Mem>(()).await.unwrap();
let vector = SurrealVectorStore::with_defaults(model, db);

let agent = client
    .agent(MINIMAX_M2_7)
    .preamble("You are a dice rolling AI. Always use tools to roll dice.")
    .tools(tools())
    .temperature(0.7)
    .max_tokens(4096)
    .dynamic_context(3, vector)
    .build();

Expected behavior

Pass the compilation

Screenshots

Additional context

SurrealSearchFilter::Value seems expect to be serde_json::Value

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions