Method: Langchain::Vectorsearch::Milvus#create_default_schema

Defined in:
lib/langchain/vectorsearch/milvus.rb

#create_default_schemaHash

Create default schema

Returns:

  • (Hash)

    The response from the server



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/langchain/vectorsearch/milvus.rb', line 54

def create_default_schema
  client.collections.create(
    auto_id: true,
    collection_name: index_name,
    fields: [
      {
        fieldName: "id",
        isPrimary: true,
        dataType: "Int64"
      }, {
        fieldName: "content",
        isPrimary: false,
        dataType: "VarChar",
        elementTypeParams: {
          max_length: "32768" # Largest allowed value
        }
      }, {
        fieldName: "vector",
        isPrimary: false,
        dataType: "FloatVector",
        elementTypeParams: {
          dim: llm.default_dimensions.to_s
        }
      }
    ]
  )
end