File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 3
3
This assumes you have built and are running the container as depicted in the main ` README.md ` .
4
4
In that case, you have a running server on port 5000.
5
5
6
+ ## Scripted
7
+
8
+ You can run the provided Ruby script to issue a request to the server on your native machine.
9
+ To do so, if you have some system Ruby installed, you can invoke this command (at the root
10
+ of this repository):
11
+
12
+ ```
13
+ ruby test/assessment-test.rb
14
+ ```
15
+
16
+ This will ping the running server's ` /assessment ` route building out the appropriate ` POST `
17
+ request with the test data in the ` test ` path of the repository.
18
+
19
+ ## Curl
20
+
6
21
You can issue a "test" rubric assessment using hard-coded content that is found in the
7
22
` test/data ` path by using the ` /test/assessment ` URL. Here, I'm using ` curl ` to show
8
23
me the headers and send a ` POST ` to that route (may take 30 to 50 seconds):
Original file line number Diff line number Diff line change
1
+ require 'net/http'
2
+ require 'uri'
3
+
4
+ # This is best done with a better client library than the
5
+ # standard one in Ruby, but we wanted this test to work with
6
+ # a stock install for the sake of quick testing.
7
+
8
+ uri = URI ( 'http://localhost:5000' )
9
+ uri . path = '/assessment'
10
+
11
+ code = File . read ( 'test/data/u3l23_01.js' )
12
+ prompt = File . read ( 'test/data/u3l23.txt' )
13
+ rubric = File . read ( 'test/data/u3l23.csv' )
14
+
15
+ form_data = [
16
+ [ 'model' , 'gpt-4-0613' ] ,
17
+ [ 'code' , code ] ,
18
+ [ 'prompt' , prompt ] ,
19
+ [ 'rubric' , rubric ] ,
20
+ [ 'remove-comments' , '1' ] ,
21
+ [ 'num-responses' , '3' ] ,
22
+ [ 'num-passing-grades' , '2' ] ,
23
+ [ 'temperature' , '0.2' ] ,
24
+ ]
25
+
26
+ request = Net ::HTTP ::Post . new ( uri )
27
+ request . set_form form_data , 'multipart/form-data'
28
+ response = Net ::HTTP . start ( uri . hostname , uri . port ) do |http |
29
+ http . request ( request )
30
+ end
31
+
32
+ puts "Content-Type: #{ response . content_type } "
33
+ puts response . body
You can’t perform that action at this time.
0 commit comments