Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Use typescript autogen for backend types in frontend.
- Try to enforce using metric tools rather than downloading assets.
- Rule to avoid overvalidating.
- Plot through python + plotly.

## Fixed
- Images not appearing in Literature search (Prompt refactor).
Expand Down
30 changes: 26 additions & 4 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,29 @@ RUN apt-get -y update
RUN apt-get -y install curl \
build-essential \
libhdf5-dev \
libboost-all-dev \
ninja-build \
nodejs \
npm
npm \
wget \
&& rm -rf /var/lib/apt/lists/* \
&& TARGETARCH=$(dpkg --print-architecture) \
&& if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \
wget https://github.com/Kitware/CMake/archive/refs/tags/v4.0.1.tar.gz -O cmake.tar.gz \
&& tar xzf cmake.tar.gz \
&& cd CMake-4.0.1 \
&& ./bootstrap --parallel=$(nproc) \
&& make -j$(nproc) \
&& make install \
&& cd .. \
&& rm -rf CMake-4.0.1 cmake.tar.gz; \
else \
apt-get update && apt-get install -y cmake && rm -rf /var/lib/apt/lists/*; \
fi

ENV CMAKE=/usr/local/bin/cmake
ENV CMAKE_POLICY_VERSION_MINIMUM=3.5
RUN which cmake && cmake --version

RUN npm install -g deno@">=2.5.0"
RUN pip install --no-cache-dir --upgrade pip
Expand All @@ -19,12 +39,14 @@ RUN mv /code/alembic /alembic
RUN mv /code/alembic.ini /alembic.ini
RUN mv /code/docker-entrypoint.sh /docker-entrypoint.sh

# Create package.json and install pyodide locally
RUN mv /code/setup_pyodide.mjs /setup_pyodide.mjs
WORKDIR /
RUN chmod +x /docker-entrypoint.sh
RUN rm -rf /code

WORKDIR /

# Download manual wheels
RUN mkdir cached_wheels && \
pip download --only-binary=:all: --no-deps -d ./cached_wheels plotly

EXPOSE 8078
ENTRYPOINT ["./docker-entrypoint.sh"]
15 changes: 1 addition & 14 deletions backend/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,4 @@
set -o errexit

alembic upgrade head
neuroagent-api --host 0.0.0.0 --port 8078 &
SERVER_PID=$!

# Wait for server to be ready
while ! curl -f http://localhost:8078/healthz 2>/dev/null; do
echo "Waiting for server to start..."
sleep 2
done

echo "Server is ready, running setup_pyodide.mjs"
node setup_pyodide.mjs

# Keep server running
wait $SERVER_PID
neuroagent-api --host 0.0.0.0 --port 8078
1 change: 0 additions & 1 deletion backend/eval/input/matplotlib_plot/expected_output.md

This file was deleted.

141 changes: 0 additions & 141 deletions backend/eval/input/matplotlib_plot/expected_tool_calls.json

This file was deleted.

1 change: 0 additions & 1 deletion backend/eval/input/matplotlib_plot/user.md

This file was deleted.

11 changes: 11 additions & 0 deletions backend/eval/input/plotting/expected_output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Plot of y = x^2
I generated the plot of y = x^2 for x in [-10, 10]. You should see an interactive Plotly figure above showing the parabola.

Equation: y = x^2
Range used: x from -10 to 10 (400 points)
If you'd like:

Different x-range or point density
The plot exported as a PNG or PDF
A version with markers, gridlines, or annotations
tell me which option you prefer and I’ll regenerate it.",
8 changes: 8 additions & 0 deletions backend/eval/input/plotting/expected_tool_calls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"name": "run-python",
"arguments": {
"python_script": "import numpy as np\nimport plotly.graph_objects as go\nx = np.linspace(-10,10,400)\ny = x**2\nfig = go.Figure()\nfig.add_trace(go.Scatter(x=x,y=y,mode='lines',name='y=x^2'))\nfig.update_layout(title='Plot of y = x^2',xaxis_title='x',yaxis_title='y')\nfig.show()\n# return something so tool returns\n'plot_generated'"
}
}
]
1 change: 1 addition & 0 deletions backend/eval/input/plotting/user.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Can you please generate a plot of y=x^2?
12 changes: 11 additions & 1 deletion backend/eval/input/sin_plot/expected_output.md
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
Here is the scatter plot of y = sin(x) with 8 points evenly spaced from 0 to 2π. The points show the sine values at these specific x coordinates. If you want, I can also provide a line plot connecting these points. Would you like that?
Plot: y = sin(x) (8 evenly spaced points from 0 to 2π)
Points used (coordinates):
(x: 0.0000, y: 0.0000)
(x: 0.8976, y: 0.7820)
(x: 1.7952, y: 0.9755)
(x: 2.6928, y: 0.4384)
(x: 3.5904, y: -0.4423)
(x: 4.4880, y: -0.9749)
(x: 5.3856, y: -0.7891)
(x: 6.2832, y: -0.0000)
The plotted figure is shown above. If you want different styling (lines only, markers only, more points, or a downloadable image), tell me which option you prefer.
82 changes: 3 additions & 79 deletions backend/eval/input/sin_plot/expected_tool_calls.json
Original file line number Diff line number Diff line change
@@ -1,84 +1,8 @@
[
{
"name": "execute-python-code",
"arguments": {
"python_code": "import numpy as np\n\n# Generate 8 evenly spaced points from 0 to 2*pi\nx_values = np.linspace(0, 2 * np.pi, 8)\n# Calculate sin(x) for these points\ny_values = np.sin(x_values)\n\n# Prepare data for plotting\npoints = [{'x': float(x), 'y': float(y)} for x, y in zip(x_values, y_values)]\npoints"
}
},
{
"name": "plot-generator",
"arguments": {
"plot_type": "json-scatterplot",
"title": "Plot of y = sin(x) with 8 evenly spaced points from 0 to 2π",
"description": "This scatter plot shows the values of y = sin(x) at 8 points evenly spaced between 0 and 2π.",
"x_label": "x (radians)",
"y_label": "sin(x)",
"piechart_values": null,
"barplot_values": null,
"scatter_values": [
{
"x": 0,
"y": 0,
"label": null,
"color": null,
"size": null
},
{
"x": 0.8975979010256552,
"y": 0.7818314824680298,
"label": null,
"color": null,
"size": null
},
{
"x": 1.7951958020513104,
"y": 0.9749279121818236,
"label": null,
"color": null,
"size": null
},
{
"x": 2.6927937030769655,
"y": 0.43388373911755823,
"label": null,
"color": null,
"size": null
},
{
"x": 3.5903916041026207,
"y": -0.433883739117558,
"label": null,
"color": null,
"size": null
},
{
"x": 4.487989505128276,
"y": -0.9749279121818236,
"label": null,
"color": null,
"size": null
},
{
"x": 5.385587406153931,
"y": -0.7818314824680299,
"label": null,
"color": null,
"size": null
},
{
"x": 6.283185307179586,
"y": -2.4492935982947064e-16,
"label": null,
"color": null,
"size": null
}
],
"histogram_values": null,
"histogram_bins": 10,
"histogram_color": null,
"linechart_values": null,
"line_style": "solid",
"line_color": null
"name": "run-python",
"arguments": {
"python_script": "import numpy as np\nimport plotly.graph_objects as go\n\n# generate 8 evenly spaced points from 0 to 2pi\nx = np.linspace(0, 2*np.pi, 8)\ny = np.sin(x)\n\nfig = go.Figure()\nfig.add_trace(go.Scatter(x=x, y=y, mode='markers+lines', name='sin(x)'))\nfig.update_layout(title='y = sin(x) (8 evenly spaced points from 0 to 2π)',\n xaxis_title='x', yaxis_title='y',\n xaxis = dict(tickmode='array', tickvals=x, ticktext=[f'{val:.2f}' for val in x]))\n\nfig.show()\n\n# return numeric lists for reference\n{\"x\": x.tolist(), \"y\": y.tolist()}"
}
}
]
Loading