1313p = Parea (api_key = os .getenv ("PAREA_API_KEY" ))
1414
1515
16- @trace # <--- If you want to log the inputs to the LLM call you can optionally add a trace decorator here
1716def call_llm (
1817 data : List [dict ],
1918 model : str = "gpt-3.5-turbo-1106" ,
20- provider : str = "openai" ,
2119 temperature : float = 0.0 ,
2220) -> CompletionResponse :
2321 return p .completion (
2422 data = Completion (
2523 llm_configuration = LLMInputs (
2624 model = model ,
27- provider = provider ,
2825 model_params = ModelParams (temp = temperature ),
2926 messages = [Message (** d ) for d in data ],
3027 )
@@ -49,7 +46,7 @@ def critic(argument: str) -> str:
4946 [
5047 {
5148 "role" : "system" ,
52- "content" : f "You are a critic."
49+ "content" : "You are a critic."
5350 "\n What unresolved questions or criticism do you have after reading the following argument?"
5451 "Provide a concise summary of your feedback." ,
5552 },
@@ -106,8 +103,7 @@ def refiner2(query: str, additional_description: str, current_arg: str, criticis
106103 "content" : "Please generate a new argument that incorporates the feedback from the user." ,
107104 },
108105 ],
109- model = "claude-2" ,
110- provider = "anthropic" ,
106+ model = "claude-3-haiku-20240307" ,
111107 )
112108
113109
@@ -128,7 +124,6 @@ def json_call():
128124 data = Completion (
129125 llm_configuration = LLMInputs (
130126 model = "gpt-3.5-turbo-1106" ,
131- provider = "openai" ,
132127 model_params = ModelParams (temp = 0.0 , response_format = {"type" : "json_object" }),
133128 messages = [Message (** d ) for d in json_messages ],
134129 )
@@ -147,12 +142,12 @@ def json_call():
147142 "Whether wine is good for you." ,
148143 additional_description = "Provide a concise, few sentence argument on why wine is good for you." ,
149144 )
150- print (result2 )
145+ print (trace_id2 , result2 )
151146 p .record_feedback (
152147 FeedbackRequest (
153148 trace_id = trace_id2 ,
154- score = 0.0 , # 0.0 (bad) to 1.0 (good)
155- target = "Moonshine is wonderful." ,
149+ score = 0.7 , # 0.0 (bad) to 1.0 (good)
150+ target = "Wine is wonderful." ,
156151 )
157152 )
158153
@@ -164,7 +159,7 @@ def json_call():
164159 p .record_feedback (
165160 FeedbackRequest (
166161 trace_id = result3 .inference_id ,
167- score = 0.7 , # 0.0 (bad) to 1.0 (good)
162+ score = 0.5 , # 0.0 (bad) to 1.0 (good)
168163 target = "Moonshine is wonderful. End of story." ,
169164 )
170165 )
0 commit comments