|
1 | | -## Backend for SimScore |
| 1 | +# SimScore API |
2 | 2 |
|
3 | | -Demo: https://sim-score.vercel.app/ |
| 3 | +An API for semantic similarity analysis and idea ranking. |
4 | 4 |
|
5 | | -Interactive Jupyter: [](https://mybinder.org/v2/gh/derjogi/simscore-api/HEAD?labpath=%2Fcentroid_plots.ipynb) |
| 5 | +Demo UI: https://simscore.xyz/ |
| 6 | +API URL: https://simscore-api.fly.dev |
| 7 | + |
| 8 | +## Features |
| 9 | + |
| 10 | +- Semantic similarity analysis for large sets of ideas |
| 11 | +- Cluster analysis with automatic category naming |
| 12 | +- Relationship graph generation |
| 13 | +- Pairwise similarity matrix |
| 14 | + |
| 15 | +## API Usage |
| 16 | + |
| 17 | +### Basic Analysis |
| 18 | + |
| 19 | +#### Guest Access |
| 20 | +SimScore API can be used without authentication, allowing you to try out the basic features with a limited daily quota. Simply make requests without an Authorization header: |
| 21 | + |
| 22 | +```bash |
| 23 | +curl -X POST "{{api-url}}/v1/rank-ideas" \ |
| 24 | +-H "Content-Type: application/json" \ |
| 25 | +-d '{ |
| 26 | + "ideas": [ |
| 27 | + {"id": "1", "idea": "Implement AI chatbot support"}, |
| 28 | + {"id": "2", "idea": "Add voice recognition features"}, |
| 29 | + {"id": "3", "idea": "Create automated customer service"} |
| 30 | + ] |
| 31 | +}' |
| 32 | +``` |
| 33 | + |
| 34 | +(Example) Response: |
| 35 | +```json |
| 36 | +{ |
| 37 | + "ranked_ideas": [ |
| 38 | + { |
| 39 | + "id": "1", |
| 40 | + "idea": "Implement AI chatbot support", |
| 41 | + "similarity_score": 0.89, |
| 42 | + "cluster_id": 0 |
| 43 | + }, |
| 44 | + { |
| 45 | + "id": "3", |
| 46 | + "idea": "Create automated customer service", |
| 47 | + "similarity_score": 0.85, |
| 48 | + "cluster_id": 0 |
| 49 | + }, |
| 50 | + { |
| 51 | + "id": "2", |
| 52 | + "idea": "Add voice recognition features", |
| 53 | + "similarity_score": 0.72, |
| 54 | + "cluster_id": 1 |
| 55 | + } |
| 56 | + ], |
| 57 | + "relationship_graph": null, |
| 58 | + "pairwise_similarity_matrix": null, |
| 59 | + "cluster_names": null |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +#### Registered Users |
| 64 | +Get higher daily quotas by registering for an account. Registration is straightforward: |
| 65 | + |
| 66 | +Create an account: |
| 67 | +```bash |
| 68 | +curl -X POST "{{api-url}}/v1/auth/signup" \ |
| 69 | +-H "Content-Type: application/json" \ |
| 70 | +-d '{ |
| 71 | + |
| 72 | + "password": "your_password" |
| 73 | +}' |
| 74 | +``` |
| 75 | + |
| 76 | +This will return your bearer token: |
| 77 | + |
| 78 | +{ |
| 79 | + "access_token": "your-bearer-token" |
| 80 | +} |
| 81 | + |
| 82 | +Once you have registered and need to access your token again, you can retrieve it with |
| 83 | +```bash |
| 84 | +curl -X POST "{{api-url}}/v1/auth/login" \ |
| 85 | +-H "Content-Type: application/json" \ |
| 86 | +-d '{ |
| 87 | + |
| 88 | + "password": "your_password" |
| 89 | +}' |
| 90 | +``` |
| 91 | + |
| 92 | +Use your token in requests: |
| 93 | +```bash |
| 94 | +curl -X POST "{{api-url}}/v1/rank-ideas" \ |
| 95 | +-H "Authorization: Bearer {{your-bearer-token here}}" \ |
| 96 | +-H "Content-Type: application/json" \ |
| 97 | +-d '{"ideas": [...]}' |
| 98 | +``` |
| 99 | + |
| 100 | +#### Enterprise Usage |
| 101 | +Need higher limits? Contact the maintainer for custom quotas tailored to your needs. |
| 102 | + |
| 103 | + |
| 104 | +### Advanced Analysis |
| 105 | +```bash |
| 106 | +curl -X POST "{{api-url}}/v1/rank-ideas" \ |
| 107 | +-H "Authorization: Bearer [your-bearer-token here]" \ |
| 108 | +-H "Content-Type: application/json" \ |
| 109 | +-d '{ |
| 110 | + "ideas": [ |
| 111 | + {"id": "1", "idea": "Implement AI chatbot support"}, |
| 112 | + {"id": "2", "idea": "Add voice recognition features"} |
| 113 | + ], |
| 114 | + "advanced_features": { |
| 115 | + "relationship_graph": true, |
| 116 | + "cluster_names": true, |
| 117 | + "pairwise_similarity_matrix": true |
| 118 | + } |
| 119 | +}' |
| 120 | +``` |
| 121 | + |
| 122 | +(Example) Response: |
| 123 | +```json |
| 124 | +{ |
| 125 | + "ranked_ideas": [ |
| 126 | + { |
| 127 | + "id": "1", |
| 128 | + "idea": "Implement AI chatbot support", |
| 129 | + "similarity_score": 0.89, |
| 130 | + "cluster_id": 0 |
| 131 | + }, |
| 132 | + { |
| 133 | + "id": "2", |
| 134 | + "idea": "Add voice recognition features", |
| 135 | + "similarity_score": 0.72, |
| 136 | + "cluster_id": 1 |
| 137 | + } |
| 138 | + ], |
| 139 | + "relationship_graph": { |
| 140 | + "nodes": [ |
| 141 | + { |
| 142 | + "id": "1", |
| 143 | + "coordinates": {"x": 0.8, "y": 0.2} |
| 144 | + }, |
| 145 | + { |
| 146 | + "id": "2", |
| 147 | + "coordinates": {"x": 0.3, "y": 0.7} |
| 148 | + }, |
| 149 | + { |
| 150 | + "id": "Centroid", |
| 151 | + "coordinates": {"x": 0.5, "y": 0.5} |
| 152 | + } |
| 153 | + ], |
| 154 | + "edges": [ |
| 155 | + { |
| 156 | + "from_id": "1", |
| 157 | + "to_id": "2", |
| 158 | + "similarity": 0.65 |
| 159 | + }, |
| 160 | + { |
| 161 | + "from_id": "1", |
| 162 | + "to_id": "Centroid", |
| 163 | + "similarity": 0.89 |
| 164 | + }, |
| 165 | + { |
| 166 | + "from_id": "2", |
| 167 | + "to_id": "Centroid", |
| 168 | + "similarity": 0.72 |
| 169 | + } |
| 170 | + ] |
| 171 | + }, |
| 172 | + "cluster_names": { |
| 173 | + "0": "AI Customer Support", |
| 174 | + "1": "Voice Technologies" |
| 175 | + }, |
| 176 | + "pairwise_similarity_matrix": [ |
| 177 | + [1.0, 0.65], |
| 178 | + [0.65, 1.0] |
| 179 | + ] |
| 180 | +} |
| 181 | +``` |
| 182 | + |
| 183 | +### Limits |
| 184 | +* At least 4 ideas need to be submitted in order for the analysis to run successful |
| 185 | +* A maxiumum of 10'000 ideas or 10mb of data (whichever is smaller) will be enforced. Should you require higher limits, please get in touch. |
0 commit comments