22
33from __future__ import annotations
44
5+ from typing import Optional
6+
57import httpx
68
7- from ..types import evaluate_score_query_params
9+ from ..types import evaluate_score_query_params , evaluate_score_highlight_params
810from .._types import Body , Omit , Query , Headers , NotGiven , omit , not_given
911from .._utils import maybe_transform , async_maybe_transform
1012from .._compat import cached_property
1820from ..types .query import Query
1921from .._base_client import make_request_options
2022from ..types .evaluate_score_query_response import EvaluateScoreQueryResponse
23+ from ..types .evaluate_score_highlight_response import EvaluateScoreHighlightResponse
2124
2225__all__ = ["EvaluateResource" , "AsyncEvaluateResource" ]
2326
@@ -75,6 +78,53 @@ def get_query(
7578 cast_to = Query ,
7679 )
7780
81+ def score_highlight (
82+ self ,
83+ * ,
84+ highlight_id : str ,
85+ comment : Optional [str ] | Omit = omit ,
86+ score : float | Omit = omit ,
87+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
88+ # The extra values given here take precedence over values defined on the client or passed to this method.
89+ extra_headers : Headers | None = None ,
90+ extra_query : Query | None = None ,
91+ extra_body : Body | None = None ,
92+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
93+ ) -> EvaluateScoreHighlightResponse :
94+ """
95+ Provide feedback on a query result.
96+
97+ Args:
98+ highlight_id: The ID of the chunk to provide feedback on.
99+
100+ comment: Comment on the chunk
101+
102+ score: Rating of the chunk from -1 (bad) to +1 (good).
103+
104+ extra_headers: Send extra headers
105+
106+ extra_query: Add additional query parameters to the request
107+
108+ extra_body: Add additional JSON properties to the request
109+
110+ timeout: Override the client-level default timeout for this request, in seconds
111+ """
112+ return self ._post (
113+ "/memories/highlights/feedback" ,
114+ body = maybe_transform (
115+ {
116+ "highlight_id" : highlight_id ,
117+ "comment" : comment ,
118+ "score" : score ,
119+ },
120+ evaluate_score_highlight_params .EvaluateScoreHighlightParams ,
121+ ),
122+ options = make_request_options (
123+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
124+ ),
125+ cast_to = EvaluateScoreHighlightResponse ,
126+ )
127+
78128 def score_query (
79129 self ,
80130 * ,
@@ -172,6 +222,53 @@ async def get_query(
172222 cast_to = Query ,
173223 )
174224
225+ async def score_highlight (
226+ self ,
227+ * ,
228+ highlight_id : str ,
229+ comment : Optional [str ] | Omit = omit ,
230+ score : float | Omit = omit ,
231+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
232+ # The extra values given here take precedence over values defined on the client or passed to this method.
233+ extra_headers : Headers | None = None ,
234+ extra_query : Query | None = None ,
235+ extra_body : Body | None = None ,
236+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
237+ ) -> EvaluateScoreHighlightResponse :
238+ """
239+ Provide feedback on a query result.
240+
241+ Args:
242+ highlight_id: The ID of the chunk to provide feedback on.
243+
244+ comment: Comment on the chunk
245+
246+ score: Rating of the chunk from -1 (bad) to +1 (good).
247+
248+ extra_headers: Send extra headers
249+
250+ extra_query: Add additional query parameters to the request
251+
252+ extra_body: Add additional JSON properties to the request
253+
254+ timeout: Override the client-level default timeout for this request, in seconds
255+ """
256+ return await self ._post (
257+ "/memories/highlights/feedback" ,
258+ body = await async_maybe_transform (
259+ {
260+ "highlight_id" : highlight_id ,
261+ "comment" : comment ,
262+ "score" : score ,
263+ },
264+ evaluate_score_highlight_params .EvaluateScoreHighlightParams ,
265+ ),
266+ options = make_request_options (
267+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
268+ ),
269+ cast_to = EvaluateScoreHighlightResponse ,
270+ )
271+
175272 async def score_query (
176273 self ,
177274 * ,
@@ -223,6 +320,9 @@ def __init__(self, evaluate: EvaluateResource) -> None:
223320 self .get_query = to_raw_response_wrapper (
224321 evaluate .get_query ,
225322 )
323+ self .score_highlight = to_raw_response_wrapper (
324+ evaluate .score_highlight ,
325+ )
226326 self .score_query = to_raw_response_wrapper (
227327 evaluate .score_query ,
228328 )
@@ -235,6 +335,9 @@ def __init__(self, evaluate: AsyncEvaluateResource) -> None:
235335 self .get_query = async_to_raw_response_wrapper (
236336 evaluate .get_query ,
237337 )
338+ self .score_highlight = async_to_raw_response_wrapper (
339+ evaluate .score_highlight ,
340+ )
238341 self .score_query = async_to_raw_response_wrapper (
239342 evaluate .score_query ,
240343 )
@@ -247,6 +350,9 @@ def __init__(self, evaluate: EvaluateResource) -> None:
247350 self .get_query = to_streamed_response_wrapper (
248351 evaluate .get_query ,
249352 )
353+ self .score_highlight = to_streamed_response_wrapper (
354+ evaluate .score_highlight ,
355+ )
250356 self .score_query = to_streamed_response_wrapper (
251357 evaluate .score_query ,
252358 )
@@ -259,6 +365,9 @@ def __init__(self, evaluate: AsyncEvaluateResource) -> None:
259365 self .get_query = async_to_streamed_response_wrapper (
260366 evaluate .get_query ,
261367 )
368+ self .score_highlight = async_to_streamed_response_wrapper (
369+ evaluate .score_highlight ,
370+ )
262371 self .score_query = async_to_streamed_response_wrapper (
263372 evaluate .score_query ,
264373 )
0 commit comments