From 09f75c35b08cb26adf316731b613e99bb3778c54 Mon Sep 17 00:00:00 2001 From: laststylebender Date: Tue, 3 Sep 2024 22:49:26 +0530 Subject: [PATCH] - rename variables --- src/cli/llm/infer_arg_name.rs | 16 ++++++++-------- ...g_name__test__to_chat_request_conversion.snap | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cli/llm/infer_arg_name.rs b/src/cli/llm/infer_arg_name.rs index 989f223166..bbbaaac9ce 100644 --- a/src/cli/llm/infer_arg_name.rs +++ b/src/cli/llm/infer_arg_name.rs @@ -43,7 +43,7 @@ impl TryFrom for Answer { #[derive(Clone, Serialize)] struct Question { - args_info: OperationDefinition, + definition: OperationDefinition, } impl TryInto for Question { @@ -65,7 +65,7 @@ impl TryInto for Question { }, }; - let input = serde_json::to_string_pretty(&Question { args_info: input2 })?; + let input = serde_json::to_string_pretty(&Question { definition: input2 })?; let output = serde_json::to_string_pretty(&Answer { suggestions: vec![ "createPostInput".into(), @@ -86,11 +86,11 @@ impl TryInto for Question { }); let rendered_prompt = template.render(&context); - - Ok(ChatRequest::new(vec![ + let request = ChatRequest::new(vec![ ChatMessage::system(rendered_prompt), - ChatMessage::user(serde_json::to_string(&self)?), - ])) + ChatMessage::user(serde_json::to_string(&self.definition)?), + ]); + Ok(request) } } @@ -124,7 +124,7 @@ impl InferArgName { }, }; - let question = Question { args_info: question }; + let question = Question { definition: question }; let mut delay = 3; loop { @@ -203,7 +203,7 @@ mod test { #[test] fn test_to_chat_request_conversion() { let question = Question { - args_info: OperationDefinition { + definition: OperationDefinition { argument: MetaData { name: "input2".to_string(), output_type: "Article".to_string(), diff --git a/src/cli/llm/snapshots/tailcall__cli__llm__infer_arg_name__test__to_chat_request_conversion.snap b/src/cli/llm/snapshots/tailcall__cli__llm__infer_arg_name__test__to_chat_request_conversion.snap index 7e0d3ef5f4..5f961081f0 100644 --- a/src/cli/llm/snapshots/tailcall__cli__llm__infer_arg_name__test__to_chat_request_conversion.snap +++ b/src/cli/llm/snapshots/tailcall__cli__llm__infer_arg_name__test__to_chat_request_conversion.snap @@ -8,14 +8,14 @@ ChatRequest { ChatMessage { role: System, content: Text( - "Given the Operation Definition of GraphQL, suggest 5 meaningful names for the argument names.\nThe name should be concise and preferably a single word.\n\nExample Input:\n{\n \"args_info\": {\n \"argument\": {\n \"name\": \"input2\",\n \"outputType\": \"Article\"\n },\n \"field\": {\n \"name\": \"createPost\",\n \"outputType\": \"Post\"\n }\n }\n}\n\nExample Output:\n{\n \"suggestions\": [\n \"createPostInput\",\n \"postInput\",\n \"articleInput\",\n \"noteInput\",\n \"messageInput\"\n ]\n}\n\nEnsure the output is in valid JSON format.\n", + "Given the Operation Definition of GraphQL, suggest 5 meaningful names for the argument names.\nThe name should be concise and preferably a single word.\n\nExample Input:\n{\n \"definition\": {\n \"argument\": {\n \"name\": \"input2\",\n \"outputType\": \"Article\"\n },\n \"field\": {\n \"name\": \"createPost\",\n \"outputType\": \"Post\"\n }\n }\n}\n\nExample Output:\n{\n \"suggestions\": [\n \"createPostInput\",\n \"postInput\",\n \"articleInput\",\n \"noteInput\",\n \"messageInput\"\n ]\n}\n\nEnsure the output is in valid JSON format.\n", ), extra: None, }, ChatMessage { role: User, content: Text( - "{\"args_info\":{\"argument\":{\"name\":\"input2\",\"outputType\":\"Article\"},\"field\":{\"name\":\"createPost\",\"outputType\":\"Post\"}}}", + "{\"argument\":{\"name\":\"input2\",\"outputType\":\"Article\"},\"field\":{\"name\":\"createPost\",\"outputType\":\"Post\"}}", ), extra: None, },