Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bruvduroiu/pinecone-mock
Lightweight Pinecone mock server written in Pure Go
https://github.com/bruvduroiu/pinecone-mock
Last synced: about 9 hours ago
JSON representation
Lightweight Pinecone mock server written in Pure Go
- Host: GitHub
- URL: https://github.com/bruvduroiu/pinecone-mock
- Owner: bruvduroiu
- Created: 2024-08-28T05:15:27.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-08-28T09:46:28.000Z (3 months ago)
- Last Synced: 2024-09-17T09:18:14.301Z (2 months ago)
- Language: Go
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
> NOTE: This project is currently unstable and under active development
# Pinecone Mock Server
Lightweight server that imitates the [Pinecone REST API](https://docs.pinecone.io/reference/api/introduction)
Intended to be used for integration tests where it's not suitable to call the Live Pinecone API.
No dependencies, just pure Go
# Usage
```
$ go build -o mock main.go$ ./mock
Server listening on port :8080
```Now you can point Pinecone to the server running on `:8080`
```python
from pinecone import Pineconeclient = Pinecone(host="localhost:8080", api_key="test")
client.create_index("test_index", dimension=3, spec={})
index = client.Index("test_index")
index.upsert([('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0])], namespace="test")
index.update(id="id1", values=[4.0, 5.0, 6.0], set_metadata={"genre": "comedy"}, namespace="test")
next(index.list())
['id1', 'id2']
```You can also use the REST API:
```
≫ curl -XPOST "http://localhost:8080/query" -d'{"topK": 2}' | jq
{
"matches": [
{
"id": "id1",
"values": [
4,
5,
6
],
"sparseValues": {},
"metadata": {
"key": "value",
"genre": "comedy"
}
},
{
"id": "id2",
"values": [
1,
2,
3
],
"sparseValues": {}
}
],
"namespace": "",
"usage": {
"read_units": 2
}
}
```