MCPcopy
hub / github.com/llmware-ai/llmware / function_call

Method function_call

llmware/models.py:4792–4939  ·  view source on GitHub ↗

This is the key inference method for SLIM models - takes a context passage and a key list which is packaged in the prompt as the keys for the dictionary output

(self, context, function=None, params=None, get_logits=False,
                      temperature=-99, max_output=None)

Source from the content-addressed store, hash-verified

4790 return full_prompt
4791
4792 def function_call(self, context, function=None, params=None, get_logits=False,
4793 temperature=-99, max_output=None):
4794
4795 """ This is the key inference method for SLIM models - takes a context passage and a key list
4796 which is packaged in the prompt as the keys for the dictionary output"""
4797
4798 self.context = context
4799
4800 if not self.fc_supported:
4801 logger.warning("OVGenerativeModel - loaded model does not support function calls. "
4802 "Please either use the standard .inference method with this model, or use a "
4803 "model that has 'function_calls' key set to True in its model card.")
4804 return []
4805
4806 # reset and start from scratch with new function call
4807 self.output_tokens = []
4808 self.logits_record = []
4809
4810 if temperature != -99:
4811 self.temperature = temperature
4812
4813 if max_output:
4814 self.target_requested_output_tokens = max_output
4815
4816 if get_logits:
4817 logger.warning("OVGenerativeModel - current implementation does not support get_logits option.")
4818 self.get_logits = False
4819
4820 if params:
4821 self.primary_keys = params
4822
4823 if function:
4824 self.function = function
4825
4826 if not self.primary_keys:
4827 logger.warning("OVGenerativeModel - function call - no keys provided - function call may "
4828 "yield unpredictable results")
4829
4830 self.preview()
4831
4832 # START - route to api endpoint
4833
4834 if self.api_endpoint:
4835 return self.function_call_over_api_endpoint(model_name=self.model_name,
4836 context=self.context,params=self.primary_keys,
4837 function=self.function,
4838 api_key=self.api_key,get_logits=self.get_logits)
4839
4840 # END - route to api endpoint
4841
4842 prompt = self.fc_prompt_engineer(self.context, params=self.primary_keys, function=function)
4843
4844 time_start = time.time()
4845
4846 # counts the input tokens
4847 if self.get_token_counts:
4848 self.input_token_count = self.ov_token_counter(prompt)
4849 else:

Callers

nothing calls this directly

Calls 8

fc_prompt_engineerMethod · 0.95
ov_token_counterMethod · 0.95
_generate_ov_genaiMethod · 0.95
ModelCatalogClass · 0.85
previewMethod · 0.80
registerMethod · 0.80

Tested by

no test coverage detected