Lune Chunks

https://api.trylune.ai/chat/get_chunks_from_lunes

This endpoint allows you to retrieve relevent context from individual Lunes.

By passing the endpoint a technical question or any string about code, the endpoint will return a list of contextual chunks that each Lune retrieves.

Request body

The API chat completions endpoint supports the following fields:

lune_ids list[string] Required:

  • Specifies the Lune(s) to use for the request. Get Lune IDs from the Lune Page by clicking 'View Details'.

user_query string Required:

  • The query to retrieve context for.

top_k int Optional (defaults to 5):

  • The number of chunks to return.

Request Example

Using the python langchain Lune to query about the AI Message Chunk object in Langchain.

curl https://api.trylune.ai/chat/get_chunks_from_lunes \
   -H "Content-Type: application/json" \
   -H "Authorization: Bearer $LUNE_API_KEY" \
   -d '{
         "lune_ids": ["d62fe81e-6f3b-48b5-a7b7-5567b6a2cd26"],
         "user_query": "What is the format of the AIMessageChunk object in Langchain?",
         "top_k": 2
       }'

Response Examples

{
  "chunks":[
      {
          "content":"context",
          "source":"https://python.langchain.com/api_reference/core/messages.html"
      },
      {
          "content":"context",
          "source":"https://python.langchain.com/api_reference/core/messages/langchain_core.messages.ai.AIMessageChunk.html"
      }
  ]
}