{"id":24363,"library":"pymochow","title":"Mochow Python SDK","description":"Python SDK for Mochow, a vector database service. Current version 2.4.0, requires Python >=3.7. Released on PyPI with regular updates.","status":"active","version":"2.4.0","language":"python","source_language":"en","source_url":"https://github.com/mochow-ai/pymochow","tags":["vector database","mochow","search","embedding","SDK"],"install":[{"cmd":"pip install pymochow","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"HTTP client for API calls","package":"requests","optional":false},{"reason":"Data validation and settings management","package":"pydantic","optional":false}],"imports":[{"note":"MochowClient is in the client submodule","wrong":"from pymochow import MochowClient","symbol":"MochowClient","correct":"from pymochow.client import MochowClient"},{"note":"Model classes are under model subpackage","symbol":"Collection","correct":"from pymochow.model.collection import Collection"},{"note":"Document class for representing vectors and metadata","symbol":"Document","correct":"from pymochow.model.document import Document"}],"quickstart":{"code":"import os\nfrom pymochow.client import MochowClient\nfrom pymochow.model.collection import Collection\nfrom pymochow.model.document import Document\n\n# Replace with your Mochow endpoint and API key\nendpoint = os.environ.get('MOCHOW_ENDPOINT', 'http://localhost:8080')\napi_key = os.environ.get('MOCHOW_API_KEY', '')\nclient = MochowClient(endpoint=endpoint, api_key=api_key)\n\n# Create a collection\ncollection = Collection(name='my_collection', dimension=128)\nclient.create_collection(collection)\n\n# Insert documents\ndoc1 = Document(id='1', vector=[0.1]*128, metadata={'title': 'doc1'})\ndoc2 = Document(id='2', vector=[0.2]*128, metadata={'title': 'doc2'})\nclient.insert(collection.name, [doc1, doc2])\n\n# Search\nresults = client.search(collection.name, query_vector=[0.15]*128, top_k=2)\nfor r in results:\n    print(r.id, r.score)","lang":"python","description":"Basic usage: create client, collection, insert documents, and search."},"warnings":[{"fix":"Use MochowClient(endpoint='...', api_key='...') with explicit keyword arguments.","message":"In version 2.x, the client initialization changed from positional arguments to keyword arguments. Using old-style instantiation will fail.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use client.search(..., limit=10) instead of top_k=10.","message":"The 'search' method's 'top_k' parameter is deprecated in favor of 'limit' starting from version 2.3.0.","severity":"deprecated","affected_versions":">=2.3.0,<3.0.0"},{"fix":"Ensure vectors are lists of floats (e.g., [0.1, 0.2, ...]) and length equals the collection's dimension.","message":"Document vector must be a list of floats with length exactly matching collection dimension. Providing an integer list or wrong dimension raises a validation error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set environment variable MOCHOW_API_KEY or pass api_key as a constructor argument.","message":"API key is required for authentication; omitting it or using an invalid key results in 401 errors.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: from pymochow.client import MochowClient","cause":"Incorrect import path; MochowClient is in the client submodule.","error":"ImportError: cannot import name 'MochowClient' from 'pymochow'"},{"fix":"Ensure every inserted document's vector length equals the collection's dimension (e.g., for 128-dim, use [0.1]*128).","cause":"Inserted document vector length does not match the collection's dimension setting during creation.","error":"pymochow.exceptions.ValidationError: vector dimension must match collection dimension"},{"fix":"Check that MOCHOW_API_KEY environment variable is set or pass a valid api_key to MochowClient.","cause":"Missing or incorrect API key.","error":"requests.exceptions.HTTPError: 401 Client Error: Unauthorized"},{"fix":"Use either positional (deprecated) or keyword only. Preferred: MochowClient(endpoint='...', api_key='...')","cause":"Passing endpoint both as positional argument and as keyword argument.","error":"TypeError: __init__() got multiple values for argument 'endpoint'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}