Get your API Key

To use Pine, you’ll need an API key. Generate one in your dashboard. It will look something like this sk-cj9IuZc4S2Vk19Bisu5WTegfa5eMXNcJGoXlHJb5nJkf. Make sure to save it in a safe place, as you will not be able to view it again on the dashboard.

Make Your First Request

To get context for your LLM query, call the API Context Endpoint. In this example, we will add context to the query "Whats new in the new MacBook Pro".

curl --request POST \
  --url https://api.pine.dev/context \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "query": "whats new in the new macbook pro"
}'

The API will return context in markdown format that you can add to your LLM query:

{
    "markdown": "# MacBook Pro 2024\n ## According to Apple the new MacBook has...",
    "markdown_token_count": 1634,
    "query": "Whats new in the new MacBook Pro",
    "sources": [
        {
            "url": "https://www.apple.com/macbook-pro/"
        },
        ...
    ]
}

Using the Response

Pine delivers context in a natural language format tailored for LLMs. Though the markdown may seem unstructured to humans, it mirrors how LLMs process information—conversationally blending specs, quotes, and updates for accurate, up-to-date responses.

# MacBook Pro Latest
Oct'24 launch - M3/Pro/Max chips (3nm!), Black color = less fingerprints finally. Reviews from NotebookCheck say 36% GPU boost, TechRadar confirms. Display same as b4 = XDR/ProMotion.
$$$ = 14" $1599 (m3) --> $2499 for 16" m3pro base.  RAM: 128GB if u get Max ver
John T. (Apple SVP) @ launch: "groundbreaking" "revolutionary" etc etc
Supply: Shanghai factory backup -2wk (bloomberg feb24). Battery = good (22hr web)
GEEKBENCH: m3max=12000+ multicore, vs m2max=~9800 thermal improved supposedly (apple didnt specify numbers??)
space black color = special coating, less fingerprints than midnight macbook air disaster
ProRes speed = 2-3x older ver. memory bandwidth = 400GB/s on Max
screen = same (1600nits hdr)
preorders ship 2-3wk current

Using Pine Context in a LLM

Once you have the context from Pine, simply include it before your query in your LLM prompt. Here’s a simple example using OpenAI:

from openai import OpenAI
client = OpenAI()

pine_context = "MacBook Pro Latest: Oct'23 launch - M3/Pro/Max chi..."

response = client.chat.completions.create(
   model="gpt-4o",
   messages=[
       {"role": "user", "content": f"""Query: What's new in the new MacBook Pro? \n Context: {context}"""}
   ]
)

print(response.choices[0].message.content)

which prints an up to date and accurate response:

The new MacBook Pro models, introduced in October 2024, feature significant internal enhancements rather than design overhaul. These updates focus on Apple’s next-generation M4, M4 Pro, and M4 Max chips, which offer impressive performance boosts over previous models. Here are the key highlights:

1. **M4 Chips**:
   - The M4 chip introduces a 10-core CPU and GPU, while the M4 Pro features a 14-core CPU and up to a 20-core GPU. The high-end M4 Max offers up to a 16-core CPU and a 40-core GPU.
   - Built on a 3-nanometer process, these chips include hardware-based ray tracing and mesh shading, enhancing gaming and professional app performance.

2. **Display**:
   - Both the 14-inch and 16-inch models feature Liquid Retina XDR displays, with SDR brightness improved to 1000 nits outdoors, up to 1600 nits peak brightness, and a 1,000,000:1 contrast ratio.
   - An option for a nano-texture display is available, reducing glare.

3. **Design**:
   - No major design changes; it maintains the existing 14.2-inch and 16.2-inch mini-LED display sizes.
   - The models come in space black or silver aluminum with large trackpads and full-sized keyboards.

4. **Battery and Connectivity**:
   - Longer battery life owing to efficiency improvements with the M4 chips.
   - Includes updated connectivity with Wi-Fi 6E and Bluetooth 5.3.
   - New Thunderbolt 5 ports on higher-end models.

5. **Camera and Features**:
   - A new 12-megapixel webcam with Center Stage and Desk View features is housed in the display's notch.
   - ProMotion technology supports adaptive refresh rates up to 120Hz.