Skip to content

Commit e16077f

Browse files
authored
Merge pull request #54 from get-convex/jordan/improvements-for-gpt
Improvements for `GPT-4o`
2 parents 9d2a9c3 + fd4526d commit e16077f

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

evals/002-queries/000-all_rows/TASK.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ export default defineSchema({
1212
});
1313
```
1414

15-
Write a query named `getAllProducts` in `convex/public.ts` that returns all products in the table.
15+
Write a query named `getAllProducts` in `convex/public.ts` that returns all products in the table, including their system fields.

evals/002-queries/002-userspace_filter/TASK.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ Write a query named `getPopularPinnedMessages` in `convex/public.ts` that:
1919
- Filters IN JAVASCRIPT (not in the database) to find messages that are:
2020
* Pinned (isPinned === true)
2121
* Have at least the minimum number of likes
22-
- Returns the filtered messages sorted by likes in descending order
22+
- Returns the filtered messages sorted by likes in descending order, including their system fields

evals/002-queries/007-aggregation/TASK.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Write a query named `getCustomerStats` in `convex/public.ts` that:
2020
* totalItems: sum of all quantities
2121
* totalSpent: sum of (quantity * pricePerUnit) for all orders
2222
* averageOrderValue: totalSpent / totalOrders
23+
- All return value fields should be numbers
2324
- You can assume that the number of orders for each customer is small.
2425
- Handle the case where customer has no orders and returns zero for all fields.
2526
- Format monetary values appropriately (2 decimal places)

runner/models/guidelines.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,21 @@ def __init__(self, name: str, children: list):
121121
});
122122
```"""
123123
),
124+
Guideline(
125+
"""Here are the valid Convex types along with their respective validators:
126+
Convex Type | TS/JS type | Example Usage | Validator for argument validation and schemas | Notes |
127+
| ----------- | ------------| -----------------------| -----------------------------------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
128+
| Id | string | `doc._id` | `v.id(tableName)` | |
129+
| Null | null | `null` | `v.null()` | JavaScript's `undefined` is not a valid Convex value. Functions the return `undefined` or do not return will return `null` when called from a client. Use `null` instead. |
130+
| Int64 | bigint | `3n` | `v.int64()` | Int64s only support BigInts between -2^63 and 2^63-1. Convex supports `bigint`s in most modern browsers. |
131+
| Float64 | number | `3.1` | `v.number()` | Convex supports all IEEE-754 double-precision floating point numbers (such as NaNs). Inf and NaN are JSON serialized as strings. |
132+
| Boolean | boolean | `true` | `v.boolean()` |
133+
| String | string | `"abc"` | `v.string()` | Strings are stored as UTF-8 and must be valid Unicode sequences. Strings must be smaller than the 1MB total size limit when encoded as UTF-8. |
134+
| Bytes | ArrayBuffer | `new ArrayBuffer(8)` | `v.bytes()` | Convex supports first class bytestrings, passed in as `ArrayBuffer`s. Bytestrings must be smaller than the 1MB total size limit for Convex types. |
135+
| Array | Array] | `[1, 3.2, "abc"]` | `v.array(values)` | Arrays can have at most 8192 values. |
136+
| Object | Object | `{a: "abc"}` | `v.object({property: value})` | Convex only supports "plain old JavaScript objects" (objects that do not have a custom prototype). Objects can have at most 1024 entries. Field names must be nonempty and not start with "$" or "_". |
137+
| Record | Record | `{"a": "1", "b": "2"}` | `v.record(keys, values)` | Records are objects at runtime, but can have dynamic keys. Keys must be only ASCII characters, nonempty, and not start with "$" or "_". |"""
138+
),
124139
],
125140
),
126141
GuidelineSection(
@@ -249,6 +264,9 @@ def __init__(self, name: str, children: list):
249264
},
250265
});
251266
```
267+
Note: `paginationOpts` is an object with the following properties:
268+
- `numItems`: the maximum number of documents to return (the validator is `v.number()`)
269+
- `cursor`: the cursor to use to fetch the next page of documents (the validator is `v.union(v.string(), v.null())`)
252270
"""
253271
),
254272
Guideline(
@@ -279,7 +297,7 @@ def __init__(self, name: str, children: list):
279297
Guideline("Always define your schema in `convex/schema.ts`."),
280298
Guideline("Always import the schema definition functions from `convex/server`:"),
281299
Guideline(
282-
"System fields are automatically added to all documents and are prefixed with an underscore."
300+
"System fields are automatically added to all documents and are prefixed with an underscore. The two system fields that are automatically added to all documents are `_creationTime` which has the validator `v.number()` and `_id` which has the validator `v.id(tableName)`."
283301
),
284302
Guideline(
285303
"""Always include all index fields in the index name. For example, if an index is defined as `["field1", "field2"]`, the index name should be "by_field1_and_field2"."""

0 commit comments

Comments
 (0)