-
Notifications
You must be signed in to change notification settings - Fork 1
Create document processor #195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0dc435b
003951b
9153b91
610d803
f9dab40
be26232
d39127d
a93bb39
2c119d1
2a6d2ee
345c843
8d98f8d
6a9dec1
40afb44
3421fdd
4d30d18
0de75c5
77a6a7f
a6ae127
44eaee9
9546e19
b52980b
cea4ce2
1599923
c3f2303
f622235
a0b7960
49692d5
aa21c13
008cbd8
3554f08
286e4e1
eab5770
cdc8f9e
48600eb
5f24647
b84f041
dacd20a
388a818
151347f
6cc9f21
e48edbd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Full Docs Sync to Vector Store | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get all MDX files and prepare payload | ||
id: files | ||
run: | | ||
# First find all MDX files recursively | ||
echo "Finding all MDX files..." | ||
find content -type f -name "*.mdx" | sed 's|^content/||' > mdx_files.txt | ||
echo "Found files:" | ||
cat mdx_files.txt | ||
|
||
# Create the changed array by processing each file through jq | ||
echo "Processing files..." | ||
jq -n --slurpfile paths <( | ||
while IFS= read -r path; do | ||
[ -z "$path" ] && continue | ||
if [ -f "content/$path" ]; then | ||
echo "Processing: content/$path" | ||
jq -n \ | ||
--arg path "$path" \ | ||
--arg content "$(base64 -w0 < "content/$path")" \ | ||
'{path: $path, content: $content}' | ||
fi | ||
done < mdx_files.txt | jq -s '.' | ||
) \ | ||
--slurpfile removed <(cat mdx_files.txt | jq -R . | jq -s .) \ | ||
--arg repo "$GITHUB_REPOSITORY" \ | ||
'{ | ||
repo: $repo, | ||
changed: ($paths | .[0] // []), | ||
removed: ($removed | .[0] // []) | ||
}' > payload.json | ||
|
||
# Show debug info | ||
echo "Payload structure (without contents):" | ||
jq 'del(.changed[].content)' payload.json | ||
|
||
- name: Send to Agentuity | ||
run: | | ||
echo "About to sync these files:" | ||
jq -r '.changed[].path' payload.json | ||
echo -e "\nWill first remove these paths:" | ||
jq -r '.removed[]' payload.json | ||
|
||
# Uncomment to actually send | ||
curl https://agentuity.ai/webhook/f61d5ce9d6ed85695cc992c55ccdc2a6 \ | ||
-X POST \ | ||
-H "Content-Type: application/json" \ | ||
-d @payload.json |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,71 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
name: Sync Docs to Vector Store | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
on: | ||||||||||||||||||||||||||||||||||||||||||||||||||
push: | ||||||||||||||||||||||||||||||||||||||||||||||||||
branches: | ||||||||||||||||||||||||||||||||||||||||||||||||||
- main | ||||||||||||||||||||||||||||||||||||||||||||||||||
paths: | ||||||||||||||||||||||||||||||||||||||||||||||||||
- 'content/**' | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||
sync: | ||||||||||||||||||||||||||||||||||||||||||||||||||
runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||
steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||
- uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
- name: Get changed and removed files | ||||||||||||||||||||||||||||||||||||||||||||||||||
id: files | ||||||||||||||||||||||||||||||||||||||||||||||||||
run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||
git fetch origin ${{ github.event.before }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
# Get changed files (relative to content directory) | ||||||||||||||||||||||||||||||||||||||||||||||||||
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} -- 'content/**/*.mdx' | sed 's|^content/||') | ||||||||||||||||||||||||||||||||||||||||||||||||||
REMOVED_FILES=$(git diff --name-only --diff-filter=D ${{ github.event.before }} ${{ github.sha }} -- 'content/**/*.mdx' | sed 's|^content/||') | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
echo "Changed files: $CHANGED_FILES" | ||||||||||||||||||||||||||||||||||||||||||||||||||
echo "Removed files: $REMOVED_FILES" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
# Build JSON payload with file contents | ||||||||||||||||||||||||||||||||||||||||||||||||||
payload=$(jq -n \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
--arg commit "${{ github.sha }}" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
--arg repo "${{ github.repository }}" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
--argjson changed "$( | ||||||||||||||||||||||||||||||||||||||||||||||||||
if [ -n "$CHANGED_FILES" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||
for f in $CHANGED_FILES; do | ||||||||||||||||||||||||||||||||||||||||||||||||||
if [ -f "content/$f" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||
jq -n \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
--arg path "$f" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
--arg content "$(base64 -w0 < "content/$f")" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
'{path: $path, content: $content}' | ||||||||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||||||||
done | jq -s '.' | ||||||||||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||||||||||
echo '[]' | ||||||||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||||||||
)" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
--argjson removed "$( | ||||||||||||||||||||||||||||||||||||||||||||||||||
if [ -n "$REMOVED_FILES" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||
printf '%s\n' $REMOVED_FILES | jq -R -s -c 'split("\n") | map(select(length > 0))' | ||||||||||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||||||||||
echo '[]' | ||||||||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||||||||
)" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
'{commit: $commit, repo: $repo, changed: $changed, removed: $removed}' | ||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
echo "payload<<EOF" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||||||
echo "$payload" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||||||
echo "EOF" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
- name: Trigger Agentuity Sync Agent | ||||||||||||||||||||||||||||||||||||||||||||||||||
env: | ||||||||||||||||||||||||||||||||||||||||||||||||||
AGENTUITY_TOKEN: ${{ secrets.AGENTUITY_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||
echo "Sending payload to agent:" | ||||||||||||||||||||||||||||||||||||||||||||||||||
echo '${{ steps.files.outputs.payload }}' | jq '.' | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
curl https://agentuity.ai/webhook/f61d5ce9d6ed85695cc992c55ccdc2a6 \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
-X POST \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
-H "Authorization: Bearer $AGENTUITY_TOKEN" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
-H "Content-Type: application/json" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
-d '${{ steps.files.outputs.payload }}' | ||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+60
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JSON payload may be corrupted by single-quote wrapping
- echo '${{ steps.files.outputs.payload }}' | jq '.'
+ printf '%s\n' "${{ steps.files.outputs.payload }}" | jq '.'
...
- -d '${{ steps.files.outputs.payload }}'
+ --data "${{ steps.files.outputs.payload }}" Also ensure a trailing newline at EOF to silence YAML-lint. 📝 Committable suggestion
Suggested change
🧰 Tools🪛 YAMLlint (1.37.1)[error] 66-66: trailing spaces (trailing-spaces) [error] 71-71: no new line character at the end of file (new-line-at-end-of-file) 🤖 Prompt for AI Agents
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# RAG System Implementation TODOs | ||
|
||
## 1. Document Chunking & Metadata | ||
- [x] Refine and test the chunking logic for MDX files. | ||
- [x] Implement full metadata enrichment (id, path, chunkIndex, contentType, heading, keywords) in the chunking/processing pipeline. | ||
- [x] Write unit tests for chunking and metadata extraction. | ||
|
||
## 2. Keyword Extraction | ||
- [x] Implement LLM-based keyword extraction for each chunk. | ||
- [x] Write tests to validate keyword extraction quality. | ||
- [ ] Integrate keyword in document processing pipeline | ||
|
||
## 3. Embedding Generation | ||
- [x] Implement embedding function for batch processing of chunk texts (using OpenAI SDK or Agentuity vector store as appropriate). | ||
- [x] Integrate embedding generation into the chunk processing pipeline. | ||
- [ ] Write tests to ensure embeddings are generated and stored correctly. | ||
|
||
## 4. Vector Store Integration | ||
- [x] Set up Agentuity vector database integration. | ||
- [x] Store chunk content, metadata, keywords, and embeddings. | ||
|
||
## 5. Hybrid Retrieval Logic | ||
- [ ] Implement hybrid search (semantic + keyword boosting). | ||
- [ ] Write tests to ensure correct ranking and recall. | ||
|
||
## 6. Reranker Integration | ||
- [ ] Integrate reranker model (API or local). | ||
- [ ] Implement reranking step after hybrid retrieval. | ||
- [ ] Write tests to validate reranker improves result quality. | ||
|
||
## 7. API Layer | ||
- [ ] Build modular API endpoints for search and retrieval. | ||
- [ ] Ensure endpoints are stateless and testable. | ||
- [ ] Write API tests (unit and integration). | ||
|
||
## 8. UI Integration | ||
- [ ] Add search bar and results display to documentation site. | ||
- [ ] Implement keyword highlighting and breadcrumb navigation. | ||
- [ ] Write UI tests for search and result presentation. | ||
|
||
## 9. Monitoring & Analytics | ||
- [ ] Add logging for search queries and result quality. | ||
- [ ] Implement feedback mechanism for users to rate results. | ||
|
||
## 10. Documentation & Developer Experience | ||
- [ ] Document each module and its tests. | ||
- [ ] Provide clear setup and usage instructions. | ||
|
||
## 11. Sync/Processor Workflow Design | ||
- [x] Design the documentation sync workflow: | ||
- [x] Primary: Trigger sync via CI/CD or GitHub Action after merges to main/deploy branch. | ||
- [x] Optional: Implement a webhook endpoint for manual or CMS-triggered syncs. | ||
- [x] Ensure the sync process is idempotent and efficient (only updates changed docs/chunks). | ||
- [x] Plan for operational workflow implementation after core modules are complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Trailing spaces & shell quoting – both break POSIX compliance
Lines 20-24 contain stray spaces that YAML-lint already highlighted. More importantly,
$CHANGED_FILES
iteration will explode on filenames containing spaces or$IFS
characters.Cleaning whitespace plus safe iteration prevents subtle sync failures.
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 20-20: trailing spaces
(trailing-spaces)
[error] 24-24: trailing spaces
(trailing-spaces)
🤖 Prompt for AI Agents