compiler-research / xeus-cpp

Jupyter kernel for the C++ programming language
BSD 3-Clause "New" or "Revised" License
17 stars 24 forks source link

xassist implementation #151

Open tharun571 opened 2 months ago

tharun571 commented 2 months ago

Description

This PR allows us to use magic commands to access LLMs.

Type of change

Please tick all options which are relevant.

codecov-commenter commented 2 months ago

Codecov Report

Attention: Patch coverage is 80.74074% with 26 lines in your changes missing coverage. Please review.

Project coverage is 81.97%. Comparing base (7d20476) to head (e64b5c8).

Files with missing lines Patch % Lines
src/xmagics/xassist.cpp 80.45% 26 Missing :warning:
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/compiler-research/xeus-cpp/pull/151/graphs/tree.svg?width=650&height=150&src=pr&token=9KM610P5A4&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=compiler-research)](https://app.codecov.io/gh/compiler-research/xeus-cpp/pull/151?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=compiler-research) ```diff @@ Coverage Diff @@ ## main #151 +/- ## ========================================== - Coverage 82.24% 81.97% -0.27% ========================================== Files 17 19 +2 Lines 625 760 +135 Branches 61 79 +18 ========================================== + Hits 514 623 +109 - Misses 111 137 +26 ``` | [Files with missing lines](https://app.codecov.io/gh/compiler-research/xeus-cpp/pull/151?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=compiler-research) | Coverage Δ | | |---|---|---| | [src/xinterpreter.cpp](https://app.codecov.io/gh/compiler-research/xeus-cpp/pull/151?src=pr&el=tree&filepath=src%2Fxinterpreter.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=compiler-research#diff-c3JjL3hpbnRlcnByZXRlci5jcHA=) | `88.75% <100.00%> (+0.07%)` | :arrow_up: | | [src/xmagics/xassist.hpp](https://app.codecov.io/gh/compiler-research/xeus-cpp/pull/151?src=pr&el=tree&filepath=src%2Fxmagics%2Fxassist.hpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=compiler-research#diff-c3JjL3htYWdpY3MveGFzc2lzdC5ocHA=) | `100.00% <100.00%> (ø)` | | | [src/xmagics/xassist.cpp](https://app.codecov.io/gh/compiler-research/xeus-cpp/pull/151?src=pr&el=tree&filepath=src%2Fxmagics%2Fxassist.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=compiler-research#diff-c3JjL3htYWdpY3MveGFzc2lzdC5jcHA=) | `80.45% <80.45%> (ø)` | | | [Files with missing lines](https://app.codecov.io/gh/compiler-research/xeus-cpp/pull/151?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=compiler-research) | Coverage Δ | | |---|---|---| | [src/xinterpreter.cpp](https://app.codecov.io/gh/compiler-research/xeus-cpp/pull/151?src=pr&el=tree&filepath=src%2Fxinterpreter.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=compiler-research#diff-c3JjL3hpbnRlcnByZXRlci5jcHA=) | `88.75% <100.00%> (+0.07%)` | :arrow_up: | | [src/xmagics/xassist.hpp](https://app.codecov.io/gh/compiler-research/xeus-cpp/pull/151?src=pr&el=tree&filepath=src%2Fxmagics%2Fxassist.hpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=compiler-research#diff-c3JjL3htYWdpY3MveGFzc2lzdC5ocHA=) | `100.00% <100.00%> (ø)` | | | [src/xmagics/xassist.cpp](https://app.codecov.io/gh/compiler-research/xeus-cpp/pull/151?src=pr&el=tree&filepath=src%2Fxmagics%2Fxassist.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=compiler-research#diff-c3JjL3htYWdpY3MveGFzc2lzdC5jcHA=) | `80.45% <80.45%> (ø)` | |
SylvainCorlay commented 1 month ago

I think this shows we need an extension system for magics, so that we don't keep to much in core xeus-cpp and have such features in extensions.

vgvassilev commented 1 month ago

Perhaps we need to implement https://github.com/compiler-research/xeus-cpp/issues/4. @tharun571, can you take a look?

I guess here the question is should we accept the PR and move it as a plugin or wait for the plugin system?

JohanMabille commented 1 day ago

I think we can accept the PR and move it to the plugin system when we have it, because the implementation does not spread across the whole kernel. My only concern is the dependency on curl, but we can probably hide it behind a building flag if we package a new version of xeus-cpp before the plugin system is available.

Nitpicking: the naming convention of xeus-cpp is snake case, not camel case, but this can be changed later (as a mechanical change that would be fast to review).