Pongo uses secret keys for accessing the API. You can generate, rename, and delete keys on the API Key dashboard.

You can only see API keys once, when they’re generated. After that you can only rename or delete them.


You can authorize HTTP requests by passing the keys in via headers. The secret key goes in as the “secret” header.

With the client libraries, you can pass the key in once and then all requests are automatically authenticated.

import pongo

#Replace the key with your actual API key
pongo_client = pongo.PongoClient(PONGO_SECRET_KEY)

query = "What color are apples?"

#pass in the top ~50-100 results from your existing pipeline, passing more results will catch more edge cases but take longer to process
results_to_filter = [{"id": 1, "text": "Oranges are orange", "metadata": {}}, 
    {"id": 2, "text": "Apples can be red or green", "metadata": {}}, 
    {"id": 3, "text": "Grapes can be purple or green", "metadata": {}}, 
    {"id": 4, "text": "Banannas are yellow", "metadata": {}}]

pongo_result = pongo_client.filter(docs=results_to_filter, query=query, num_results=10, public_metadata_field="metadata", key_field="id", text_field='text')

#List of the 10 most relevant documents to the query
filtered_docs = pongo_result.json()