-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.Rmd
More file actions
115 lines (84 loc) · 3.24 KB
/
Copy pathindex.Rmd
File metadata and controls
115 lines (84 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, eval = FALSE)
```
# pineconer <img src="man/figures/logo.png" align="right" height="139" alt="" />
<!-- badges: start -->
[](https://github.com/bob-rietveld/pineconer/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
An R interface to the [Pinecone](https://www.pinecone.io/) vector database API for building similarity search and RAG (Retrieval-Augmented Generation) applications.
## Overview
pineconer provides a comprehensive set of functions for working with the Pinecone vector database directly from R:
- **Index Management** - Create, configure, and manage serverless or pod-based indexes
- **Vector Operations** - Query, upsert, fetch, update, and delete vectors with filtering support
- **Inference API** - Generate embeddings and rerank results using Pinecone's hosted models
- **Assistants API** - Build RAG applications by uploading documents and chatting with AI assistants
- **Bulk Operations** - Import large datasets efficiently from cloud storage
## Installation
Install the development version from GitHub:
```{r}
# install.packages("pak")
pak::pak("bob-rietveld/pineconer")
```
## Configuration
Set your Pinecone API key in `~/.Renviron`:
```
PINECONE_API_KEY=your_api_key
```
## Quick Start
### Create an Index
```{r}
library(pineconer)
# Create a serverless index
create_index(
name = "my-index",
dimension = 1536,
metric = "cosine",
spec = list(serverless = list(cloud = "aws", region = "us-east-1"))
)
```
### Query Vectors
```{r}
# Get index info
index <- describe_index("my-index")
# Query for similar vectors
results <- vector_query(
index = index,
vector = my_embedding,
top_k = 10
)
```
### Use the Assistants API
```{r}
# Create an assistant for RAG
create_assistant(name = "my-assistant")
# Upload documents
assistant_upload_file("my-assistant", "documents/report.pdf")
# Chat with your documents
response <- assistant_chat(
assistant_name = "my-assistant",
messages = list(
list(role = "user", content = "Summarize the key findings")
)
)
response$content$message$content
```
## Features
| Feature | Functions |
|---------|-----------|
| **Indexes** | `create_index()`, `list_indexes()`, `describe_index()`, `configure_index()`, `delete_index()` |
| **Vectors** | `vector_query()`, `vector_upsert()`, `vector_fetch()`, `vector_update()`, `vector_delete()` |
| **Collections** | `create_collection()`, `list_collections()`, `describe_collection()`, `delete_collection()` |
| **Inference** | `embed()`, `rerank()` |
| **Records** | `records_upsert()`, `records_search()` |
| **Assistants** | `create_assistant()`, `assistant_upload_file()`, `assistant_chat()`, `assistant_context()` |
| **Bulk Import** | `start_import()`, `describe_import()`, `list_imports()` |
## Learn More
- [Getting Started](articles/getting-started.html) - Step-by-step guide to using pineconer
- [Assistants API](articles/assistants.html) - Build RAG applications with Pinecone Assistants
- [Inference API](articles/inference.html) - Generate embeddings and rerank results
- [Function Reference](reference/index.html) - Complete API documentation
## License
MIT