MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / addHelpers

Function addHelpers

out/cli.cjs:78955–79000  ·  view source on GitHub ↗
(response)

Source from the content-addressed store, hash-verified

78953 requestOptions.signal.addEventListener("abort", () => {
78954 controller.abort();
78955 });
78956 }
78957 fetchOptions.signal = controller.signal;
78958 }
78959 return fetchOptions;
78960}
78961function addHelpers(response) {
78962 response.text = () => {
78963 if (response.candidates && response.candidates.length > 0) {
78964 if (response.candidates.length > 1) {
78965 console.warn(`This response had ${response.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`);
78966 }
78967 if (hadBadFinishReason(response.candidates[0])) {
78968 throw new GoogleGenerativeAIResponseError(`${formatBlockErrorMessage(response)}`, response);
78969 }
78970 return getText(response);
78971 } else if (response.promptFeedback) {
78972 throw new GoogleGenerativeAIResponseError(`Text not available. ${formatBlockErrorMessage(response)}`, response);
78973 }
78974 return "";
78975 };
78976 response.functionCall = () => {
78977 if (response.candidates && response.candidates.length > 0) {
78978 if (response.candidates.length > 1) {
78979 console.warn(`This response had ${response.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`);
78980 }
78981 if (hadBadFinishReason(response.candidates[0])) {
78982 throw new GoogleGenerativeAIResponseError(`${formatBlockErrorMessage(response)}`, response);
78983 }
78984 console.warn(`response.functionCall() is deprecated. Use response.functionCalls() instead.`);
78985 return getFunctionCalls(response)[0];
78986 } else if (response.promptFeedback) {
78987 throw new GoogleGenerativeAIResponseError(`Function call not available. ${formatBlockErrorMessage(response)}`, response);
78988 }
78989 return void 0;
78990 };
78991 response.functionCalls = () => {
78992 if (response.candidates && response.candidates.length > 0) {
78993 if (response.candidates.length > 1) {
78994 console.warn(`This response had ${response.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`);
78995 }
78996 if (hadBadFinishReason(response.candidates[0])) {
78997 throw new GoogleGenerativeAIResponseError(`${formatBlockErrorMessage(response)}`, response);
78998 }
78999 return getFunctionCalls(response);
79000 } else if (response.promptFeedback) {
79001 throw new GoogleGenerativeAIResponseError(`Function call not available. ${formatBlockErrorMessage(response)}`, response);
79002 }
79003 return void 0;

Callers 3

getResponsePromiseFunction · 0.85
generateResponseSequenceFunction · 0.85
generateContentFunction · 0.85

Calls 4

hadBadFinishReasonFunction · 0.85
formatBlockErrorMessageFunction · 0.85
getTextFunction · 0.85
getFunctionCallsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…