Skip to content

[native_doc_dartifier] Experiment usage of RAG in concising bindings context #2472

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

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/native_doc_dartifier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
sdk: [stable]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

- name: Pull and run chromadb container
run: |
docker pull chromadb/chroma:0.5.16
docker run -d --name chromadb-instance -p 8000:8000 chromadb/chroma:0.5.16

- uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046
with:
channel: ${{ matrix.sdk }}
Expand Down
11 changes: 5 additions & 6 deletions pkgs/native_doc_dartifier/lib/src/public_abstractor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'ast.dart';
String generateBindingsSummary(String sourceCode) {
final abstractor = PublicAbstractor();
parseString(content: sourceCode).unit.visitChildren(abstractor);
final summary = abstractor.getRepresentation();
final summary = abstractor.getClassesSummary().join('\n\n');
return summary.replaceAll('jni\$_.', '').replaceAll('core\$_.', '');
}

Expand Down Expand Up @@ -142,13 +142,12 @@ class PublicAbstractor extends RecursiveAstVisitor<void> {
);
}

String getRepresentation() {
final buffer = StringBuffer();
List<String> getClassesSummary() {
final classesSummary = <String>[];

for (final classInfo in _classes.values) {
buffer.writeln(classInfo.toDartLikeRepresentaion());
buffer.writeln();
classesSummary.add(classInfo.toDartLikeRepresentaion());
}
return buffer.toString();
return classesSummary;
}
}
1 change: 1 addition & 0 deletions pkgs/native_doc_dartifier/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ environment:
dependencies:
# path: ^1.8.0
analyzer: ^7.4.5
chromadb: ^0.2.1
google_generative_ai: ^0.4.7
jni: ^0.14.2

Expand Down
Loading