Skip to content
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

Adds simple POST endpoint at /runSquiggle, and adds open-api.json schema #2523

Merged
merged 11 commits into from
Jan 1, 2024

Conversation

OAGr
Copy link
Contributor

@OAGr OAGr commented Nov 12, 2023

This is pretty basic, but should be good enough for ChatGPT

Copy link

changeset-bot bot commented Nov 12, 2023

⚠️ No Changeset found

Latest commit: 5c1f624

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Nov 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quri-hub ✅ Ready (Inspect) Visit Preview Dec 31, 2023 6:10am
squiggle-components ✅ Ready (Inspect) Visit Preview Dec 31, 2023 6:10am
squiggle-website ✅ Ready (Inspect) Visit Preview Dec 31, 2023 6:10am
1 Ignored Deployment
Name Status Preview Updated (UTC)
quri-ui ⬜️ Ignored (Inspect) Visit Preview Dec 31, 2023 6:10am

Copy link
Contributor

sweep-ai bot commented Nov 12, 2023

Apply Sweep Rules to your PR?

  • Apply: All docstrings and comments should be up to date.
  • Apply: Ensure that all variables and functions have descriptive names.
  • Apply: Avoid using unnecessary separators or extra characters in code.
  • Apply: Use consistent indentation and spacing throughout the code.
  • Apply: Ensure that all code is properly formatted and follows the style guide.
  • Apply: Avoid using magic numbers or hard-coded values in the code.

@OAGr
Copy link
Contributor Author

OAGr commented Nov 12, 2023

That said, I can't seem to get ChatGPT to actually run this yet. It feels like all functions are failing for me. I'll continue to try.

image

@OAGr
Copy link
Contributor Author

OAGr commented Nov 12, 2023

This is meant to close #2521

@@ -0,0 +1,43 @@
import { runSquiggle } from "@/graphql/queries/runSquiggle";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: I assume I should make a helper here

import { runSquiggle } from "@/graphql/queries/runSquiggle";
import { NextRequest, NextResponse } from "next/server";

export function GET(request: NextRequest) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: remove

@@ -21,6 +25,20 @@ export const squiggleValueToJSON = (value: SqValue) => {
if (value instanceof Map) {
return Object.fromEntries(value.entries());
}
if (value instanceof SqLambda) {
return value.toString();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: Also do this for calculators, and if there are any other responses that have Lambdas

* main: (533 commits)
  Hot fix for method scale
  remove import assertion
  Added back scale default constants
  Added changeset
  ScaleShift -> Method
  Added back defaults to SqScale
  First pass on refactoring Scale
  convert textmate-grammar to a public package; highlight squiggle code in markdown
  MarkdownViewer uses shiki instead of react-syntax-highlighter
  Finishing touches to Tag.doc
  Changing @description to @doc
  Fixes from CR
  fix version order; fix insertVersion script
  Fixed minor import error
  Refactored text size and color data to be in MarkdownViewer
  support decorators on exported vars
  Update packages/website/scripts/compileDocsForLLM.js
  Update tag.ts
  Final touches to LLMPrompt page
  support 0.9.0 in ModelExportPage
  ...
* serialization-test:
  Fixed some bugs that I'm surprised were ever there
  Merged with main
  Deleted unused file
  Minor refactors to SimpleValue
  Some simple JSON tests
  Moved JSON methods to Danger
  Cleaning up SimpleValue
  Fixed map issue
  Restructure to fix most tests
  Moving SimpleValue code
  Simplifying SimpleValue
  Fixed merge with main
  Experiment with adding serialization
@OAGr OAGr changed the base branch from main to Focus-tag December 31, 2023 02:35
@OAGr OAGr changed the base branch from Focus-tag to main December 31, 2023 02:35
Copy link

codecov bot commented Dec 31, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2f70a2a) 70.15% compared to head (5c1f624) 70.17%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2523      +/-   ##
==========================================
+ Coverage   70.15%   70.17%   +0.02%     
==========================================
  Files         119      119              
  Lines        6748     6750       +2     
  Branches     1436     1436              
==========================================
+ Hits         4734     4737       +3     
+ Misses       2006     2005       -1     
  Partials        8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

const project = SqProject.create();
const env = {
sampleCount: 1000, // int
xyPointLength: 1000, // int
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could see making this configurable later

@OAGr OAGr changed the title Adds simple experimental POST endpoint Adds simple POST endpoint at /runSquiggle, and adds open-api.json schema Dec 31, 2023
@OAGr OAGr marked this pull request as ready for review December 31, 2023 06:10
@OAGr OAGr requested a review from berekuk as a code owner December 31, 2023 06:10
@OAGr
Copy link
Contributor Author

OAGr commented Jan 1, 2024

I'm going to merge, so I can make sure it's working with ChatGPT. Happy to make changes later on.

@OAGr OAGr merged commit 431ee43 into main Jan 1, 2024
9 checks passed
@OAGr OAGr deleted the run-squiggle-post-endpoint branch January 1, 2024 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant