From 5f05f3b005aa3473285082be1ab4f0a93ac6e5df Mon Sep 17 00:00:00 2001 From: Richard Liaw Date: Thu, 20 Feb 2025 21:54:42 -0800 Subject: [PATCH] [docs][data/llm] Minor http docstring improvement (#50777) ## Why are these changes needed? Docstring improvements ## Related issue number ## Checks - [ ] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [ ] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Richard Liaw --- python/ray/data/llm.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/python/ray/data/llm.py b/python/ray/data/llm.py index a0b1cd0317aa2..1a848617fd13b 100644 --- a/python/ray/data/llm.py +++ b/python/ray/data/llm.py @@ -52,16 +52,18 @@ class HttpRequestProcessorConfig(_HttpRequestProcessorConfig): processor = build_llm_processor( config, preprocess=lambda row: dict( - model="gpt-4o-mini", - messages=[ - {"role": "system", "content": "You are a calculator"}, - {"role": "user", "content": f"{row['id']} ** 3 = ?"}, - ], - temperature=0.3, - max_tokens=20, + payload=dict( + model="gpt-4o-mini", + messages=[ + {"role": "system", "content": "You are a calculator"}, + {"role": "user", "content": f"{row['id']} ** 3 = ?"}, + ], + temperature=0.3, + max_tokens=20, + ), ), postprocess=lambda row: dict( - resp=row["choices"][0]["message"]["content"], + resp=row["http_response"]["choices"][0]["message"]["content"], ), )