inputs
stringlengths
312
52k
targets
stringlengths
1
3.1k
โŒ€
block_type
stringclasses
11 values
scenario
stringclasses
7 values
<filename>microagents/agents/microagent.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/ui/format.py def print_agent_statistics(agent): """ Print statistics for a given agent. """ print(f"๐Ÿ“Š Stats for {agent.purpose}:") ...
# Initialize components used by the agent
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/app/app.py def get_top_urls(scores_dict: dict, n: int): sorted_urls = sorted(scores_dict.items(), key=lambda x: x[1], reverse=True) top_n...
result[url] = idf_score * numerator / denominator
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/app/app.py def get_top_urls(scores_dict: dict, n: int): sorted_urls = sorted(scores_dict.items(), key=lambda x: x[1], reverse=True) top_n...
old[url] += score
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/app/app.py def get_top_urls(scores_dict: dict, n: int): sorted_urls = sorted(scores_dict.items(), key=lambda x: x[1], reverse=True) top_n...
idf_score = self.idf(kw)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/app/app.py def get_top_urls(scores_dict: dict, n: int): sorted_urls = sorted(scores_dict.items(), key=lambda x: x[1], reverse=True) top_n...
self._index: dict[str, dict[str, int]] = defaultdict(lambda: defaultdict(int))
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/download_content.py def clean_content(html_content): soup = BeautifulSoup(html_content, "html.parser") for script in soup(["script", "sty...
self._documents[url] = content
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/app/app.py def get_top_urls(scores_dict: dict, n: int): sorted_urls = sorted(scores_dict.items(), key=lambda x: x[1], reverse=True) top_n...
denominator = freq + self.k1 * ( 1 - self.b + self.b * len(self._documents[url]) / avdl )
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/app/app.py def get_top_urls(scores_dict: dict, n: int): sorted_urls = sorted(scores_dict.items(), key=lambda x: x[1], reverse=True) top_n...
result = {}
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/download_content.py def clean_content(html_content): soup = BeautifulSoup(html_content, "html.parser") for script in soup(["script", "sty...
string_without_double_spaces = " ".join(string_without_punc.split())
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/app/app.py async def search_results(request: Request, query: str = Path(...)): results = engine.search(query) results = get_top_urls(resu...
return url_scores
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/app/app.py async def search_results(request: Request, query: str = Path(...)): results = engine.search(query) results = get_top_urls(resu...
n_kw = len(self.get_urls(kw))
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/download_content.py def clean_content(html_content): soup = BeautifulSoup(html_content, "html.parser") for script in soup(["script", "sty...
for word in words: self._index[word][url] += 1
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/app/app.py def get_top_urls(scores_dict: dict, n: int): sorted_urls = sorted(scores_dict.items(), key=lambda x: x[1], reverse=True) top_n...
for url, score in new.items(): if url in old: old[url] += score else: old[url] = score
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/app/app.py async def search_results(request: Request, query: str = Path(...)): results = engine.search(query) results = get_top_urls(resu...
for kw in keywords: kw_urls_score = self.bm25(kw) url_scores = update_url_scores(url_scores, kw_urls_score)
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/app/app.py def get_top_urls(scores_dict: dict, n: int): sorted_urls = sorted(scores_dict.items(), key=lambda x: x[1], reverse=True) top_n...
for url, freq in self.get_urls(kw).items(): numerator = freq * (self.k1 + 1) denominator = freq + self.k1 * ( 1 - self.b + self.b * len(self._documents[url]) / avdl ) result[url] = idf_score * numerator / denominator
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/download_content.py async def process_feed(feed_url, session, loop): try: post_urls = await loop.run_in_executor(None, parse_feed, fe...
for url, content in documents: self.index(url, content)
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microsearch/src/microsearch/engine.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microsearch/app/app.py def get_top_urls(scores_dict: dict, n: int): sorted_urls = sorted(scores_dict.items(), key=lambda x: x[1], reverse=True) top_n...
if url in old: old[url] += score else: old[url] = score
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/line_parser.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor_utils/ner_dict.py def contains_letter_and_number(text: str): return text.isalnum() and not text.is...
self.list_type = list_types[text[0]]
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/processors.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/text_ingestor.py def blocks_to_json(page_blocks): results = [] block_count = 0 for page_idx, blocks...
line_set.add(line_without_numbers)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/processors.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/text_ingestor.py def blocks_to_json(page_blocks): results = [] block_count = 0 for page_idx, blocks...
block = { "block_idx": block_idx, "block_text": running_line, "block_type": line_type, "text_group_start_idx": -1, "block_list": [], "header_block_idx": header_block_idx, "level": ...
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/line_parser.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/table_builder.py def get_row1(row): orignal_row = row words = row.split(" ") cells = [] try: ...
self.length = len(self.text)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/line_parser.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/table_builder.py def get_row1(row): orignal_row = row words = row.split(" ") cells = [] try: ...
n = self.check_numeric()
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/line_parser.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/table_builder.py def get_row1(row): orignal_row = row words = row.split(" ") cells = [] try: ...
self.text = token
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor_utils/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/line_parser.py def check_numbered_line(self, word): trunc_word = word ends_with_parens = w...
modified_sents = nltk_tokenzier.tokenize(modified_text)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/line_parser.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/table_builder.py def check_number_type(num): dollar = ( re.search(r"^[\(]*\$\d[\d\.\,)]*$", num) i...
self.is_table_row = False
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor_utils/spell_utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/processors.py def fix_spaced_characters(line_text): line_text = re.sub(r"\s+", "", line_text) re...
suggestion = self.sym_spell.word_segmentation(input_term)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor_utils/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/line_parser.py def check_numbered_line(self, word): trunc_word = word ends_with_parens = w...
return sents
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/processors.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/text_ingestor.py def blocks_to_json(page_blocks): results = [] block_count = 0 for page_idx, blocks...
if len(line_buffer) > 0: # find out if previous line was a discontinous line prev_line = line_buffer[-1] logger.debug("========") logger.debug(f"{prev_line.incomplete_line} >> {prev_line.text} \n") logger.debug(f"{curr_line.continuing_line} >> {curr_line.tex...
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/processors.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/text_ingestor.py def blocks_to_json(page_blocks): results = [] block_count = 0 for page_idx, blocks...
if not line_type == "list_item": line_type = "para"
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor_utils/spell_utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/processors.py def fix_spaced_characters(line_text): line_text = re.sub(r"\s+", "", line_text) re...
if is_mixed_case_term: corrected_string = string.capwords(corrected_string)
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/line_parser.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/table_builder.py def get_row1(row): orignal_row = row words = row.split(" ") cells = [] try: ...
if n: n = round(float(n)) if n > 0: digits = int(math.log10(n)) + 1 elif n == 0: digits = 1 else: digits = int(math.log10(-n)) + 2 self.num_digits = digits if digit...
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/processors.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/text_ingestor.py def blocks_to_json(page_blocks): results = [] block_count = 0 for page_idx, blocks...
if ( is_incomplete and not (curr_line.is_list_or_row or curr_line.line_type == "list_item") ) or curr_line.continuing_line: logger.debug("connecting..") running_line = formatter.connect(running_line, curr_line.text) line_buffer....
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/line_parser.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/table_builder.py def get_row1(row): orignal_row = row words = row.split(" ") cells = [] try: ...
if n > 0: digits = int(math.log10(n)) + 1 elif n == 0: digits = 1 else: digits = int(math.log10(-n)) + 2
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/line_parser.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/table_builder.py def check_number_type(num): dollar = ( re.search(r"^[\(]*\$\d[\d\.\,)]*$", num) i...
if not self.is_header: value_count = ( self.number_count + self.dollar_count + self.pct_count + self.text.count(" - ") ) word_symbols = self.word_count - self.dollar_sign_count if word_symbols == 0: ...
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor_utils/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/line_parser.py def check_numbered_line(self, word): trunc_word = word ends_with_parens = w...
for org_text in org_texts.split("\n"): org_text = space_rule.sub(r'\1', org_text) modified_text = re.sub(r'^([.,?!]\s+)+', "", org_text) # To handle bug https://github.com/nltk/nltk/issues/2925 orig_offset = abs(len(org_text) - len(modified_text)) # do not break bracket for spa...
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor_utils/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/line_parser.py def check_numbered_line(self, word): trunc_word = word ends_with_parens = w...
for rule, replaced in rules: modified_text = rule.sub(replaced, modified_text)
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/processors.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/text_ingestor.py def blocks_to_json(page_blocks): results = [] block_count = 0 for page_idx, blocks...
for line_str in lines: # print(line_str) line_str = clean_line(line_str) if should_skip(line_str, xml=xml): continue line_without_numbers = re.sub(r"\d+", "", line_str) if line_without_numbers in line_set: continue else: line_set.add(l...
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/processors.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/text_ingestor.py def blocks_to_json(page_blocks): results = [] block_count = 0 for page_idx, blocks...
# if line_type == "list_item":
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor_utils/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/line_parser.py def check_numbered_line(self, word): trunc_word = word ends_with_parens = w...
# if len(span.split()) >= 10:
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/line_parser.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/table_builder.py def get_row1(row): orignal_row = row words = row.split(" ") cells = [] try: ...
# year does not count as a number
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor_utils/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/line_parser.py def check_numbered_line(self, word): trunc_word = word ends_with_parens = w...
# edge case for html and markdown
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor_utils/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/line_parser.py def check_numbered_line(self, word): trunc_word = word ends_with_parens = w...
# cut org_text based on lengths of modified_sent
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/processors.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/text_ingestor.py def blocks_to_json(page_blocks): results = [] block_count = 0 for page_idx, blocks...
# commit the line and start a new line
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor_utils/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/line_parser.py def check_numbered_line(self, word): trunc_word = word ends_with_parens = w...
# skip this logic when span is too big? disabled for now
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/processors.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/text_ingestor.py def blocks_to_json(page_blocks): results = [] block_count = 0 for page_idx, blocks...
# if we are connecting lines, then this has to be a para unless it is a list_item, basically no headers
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/processors.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/text_ingestor.py def blocks_to_json(page_blocks): results = [] block_count = 0 for page_idx, blocks...
# running_line = running_line[1:].lstrip()
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor_utils/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/line_parser.py def check_numbered_line(self, word): trunc_word = word ends_with_parens = w...
# do not break bracket
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor_utils/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/line_parser.py def check_numbered_line(self, word): trunc_word = word ends_with_parens = w...
while offset < len(modified_text) and sent_idx < len(modified_sents): if modified_text[offset] == " ": offset += 1 continue # cut org_text based on lengths of modified_sent modified_sent = modified_sents[sent_idx] sents.append(org_text[off...
WHILE
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/line_parser.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/table_builder.py def get_row1(row): orignal_row = row words = row.split(" ") cells = [] try: ...
try: if n: n = round(float(n)) if n > 0: digits = int(math.log10(n)) + 1 elif n == 0: digits = 1 else: digits = int(math.log10(-n)) + 2 self.num_digits = digits ...
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>nlm-ingestor/nlm_ingestor/ingestor/line_parser.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # nlm-ingestor/nlm_ingestor/ingestor/table_builder.py def get_row1(row): orignal_row = row words = row.split(" ") cells = [] try: ...
except Exception as e: logging.error(e) self.num_digits = 0
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str): super().__init__(error) self.error = error 'Reason for the error.' # ollama-python/ol...
if (realpath := _as_path(path)) and realpath.exists(): modelfile = self._parse_modelfile(realpath.read_text(), base=realpath.parent) elif modelfile: modelfile = self._parse_modelfile(modelfile) else: raise RequestError('must provide either path or modelfile')
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def speak(speaker, content): if speaker: p = await asyncio.create_subprocess_exec(speaker, content) ...
if stream: return await self._stream(*args, **kwargs)
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def main(): parser = argparse.ArgumentParser() parser.add_argument('--speak', default=False, action='sto...
if path.exists(): args = f'@{await self._create_blob(path)}\n'
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def main(): parser = argparse.ArgumentParser() parser.add_argument('--speak', default=False, action='sto...
if command.upper() not in ['FROM', 'ADAPTER']: print(line, end='', file=out) continue
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def speak(speaker, content): if speaker: p = await asyncio.create_subprocess_exec(speaker, content) ...
if b := _as_bytesio(image): return b64encode(b.read()).decode('utf-8')
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def main(): parser = argparse.ArgumentParser() parser.add_argument('--speak', default=False, action='sto...
if command.upper() not in ['FROM', 'ADAPTER']: print(line, end='', file=out) continue
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def main(): parser = argparse.ArgumentParser() parser.add_argument('--speak', default=False, action='sto...
if (realpath := _as_path(path)) and realpath.exists(): modelfile = await self._parse_modelfile(realpath.read_text(), base=realpath.parent) elif modelfile: modelfile = await self._parse_modelfile(modelfile) else: raise RequestError('must provide either path or modelfile')
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def speak(speaker, content): if speaker: p = await asyncio.create_subprocess_exec(speaker, content) ...
if not chunk: break
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
if not chunk: break
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def speak(speaker, content): if speaker: p = await asyncio.create_subprocess_exec(speaker, content) ...
if isinstance(s, io.BytesIO): return s elif isinstance(s, bytes): return io.BytesIO(s)
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def main(): parser = argparse.ArgumentParser() parser.add_argument('--speak', default=False, action='sto...
print(command, args, end='', file=out)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def main(): parser = argparse.ArgumentParser() parser.add_argument('--speak', default=False, action='sto...
path = path if path.is_absolute() else base / path
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def speak(speaker, content): if speaker: p = await asyncio.create_subprocess_exec(speaker, content) ...
return b64encode(b.read()).decode('utf-8')
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def speak(speaker, content): if speaker: p = await asyncio.create_subprocess_exec(speaker, content) ...
b64decode(image, validate=True)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def main(): parser = argparse.ArgumentParser() parser.add_argument('--speak', default=False, action='sto...
command, _, args = line.partition(' ')
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
return self._stream(*args, **kwargs) if stream else self._request(*args, **kwargs).json()
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str): super().__init__(error) self.error = error 'Reason for the error.' # ollama-python/ol...
modelfile = self._parse_modelfile(modelfile)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_types.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_client.py def __init__(self, host: Optional[str] = None, **kwargs) -> None: super().__init__(httpx.Client, host, **kwargs) # ollama-pyt...
error = json.loads(error).get('error', error)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def main(): parser = argparse.ArgumentParser() parser.add_argument('--speak', default=False, action='sto...
split = urllib.parse.urlsplit('://'.join([scheme, hostport]))
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
yield partial
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def main(): parser = argparse.ArgumentParser() parser.add_argument('--speak', default=False, action='sto...
""" >>> _parse_host(None) 'http://127.0.0.1:11434' >>> _parse_host('') 'http://127.0.0.1:11434' >>> _parse_host('1.2.3.4') 'http://1.2.3.4:11434' >>> _parse_host(':56789') 'http://127.0.0.1:56789' >>> _parse_host('1.2.3.4:56789') 'http://1.2.3.4:56789' >>> _parse_host('http://1.2.3.4') 'http://1...
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str): super().__init__(error) self.error = error 'Reason for the error.' # ollama-python/ol...
""" Raises `ResponseError` if the request could not be fulfilled. Returns `ProgressResponse` if `stream` is `False`, otherwise returns a `ProgressResponse` generator. """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
""" Create a chat response using the requested model. Raises `RequestError` if a model is not provided. Raises `ResponseError` if the request could not be fulfilled. Returns `ChatResponse` if `stream` is `False`, otherwise returns an asynchronous `ChatResponse` generator. """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def main(): parser = argparse.ArgumentParser() parser.add_argument('--speak', default=False, action='sto...
""" Raises `ResponseError` if the request could not be fulfilled. Returns `ProgressResponse` if `stream` is `False`, otherwise returns a `ProgressResponse` generator. """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
""" Create a response using the requested model. Raises `RequestError` if a model is not provided. Raises `ResponseError` if the request could not be fulfilled. Returns `GenerateResponse` if `stream` is `False`, otherwise returns a `GenerateResponse` generator. """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str): super().__init__(error) self.error = error 'Reason for the error.' # ollama-python/ex...
""" Raises `ResponseError` if the request could not be fulfilled. Returns `ProgressResponse` if `stream` is `False`, otherwise returns a `ProgressResponse` generator. """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str): super().__init__(error) self.error = error 'Reason for the error.' # ollama-python/ex...
""" Raises `ResponseError` if the request could not be fulfilled. Returns `ProgressResponse` if `stream` is `False`, otherwise returns a `ProgressResponse` generator. """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
""" Creates a httpx client. Default parameters are the same as those defined in httpx except for the following: - `follow_redirects`: True - `timeout`: None `kwargs` are passed to the httpx client. """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def speak(speaker, content): if speaker: p = await asyncio.create_subprocess_exec(speaker, content) ...
""" >>> _encode_image(b'ollama') 'b2xsYW1h' >>> _encode_image(io.BytesIO(b'ollama')) 'b2xsYW1h' >>> _encode_image('LICENSE') 'TUlUIExpY2Vuc2UKCkNvcHlyaWdodCAoYykgT2xsYW1hCgpQZXJtaXNzaW9uIGlzIGhlcmVieSBncmFudGVkLCBmcmVlIG9mIGNoYXJnZSwgdG8gYW55IHBlcnNvbiBvYnRhaW5pbmcgYSBjb3B5Cm9mIHRoaXMgc29mdHdhcmUgYW5kIGFzc2...
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str): super().__init__(error) self.error = error 'Reason for the error.' # ollama-python/ex...
""" Raises `ResponseError` if the request could not be fulfilled. Returns `ProgressResponse` if `stream` is `False`, otherwise returns a `ProgressResponse` generator. """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
try: r.raise_for_status()
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def speak(speaker, content): if speaker: p = await asyncio.create_subprocess_exec(speaker, content) ...
try: await self._request('HEAD', f'/api/blobs/{digest}')
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
try: self._request('HEAD', f'/api/blobs/{digest}')
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
try: r.raise_for_status()
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
try: r.raise_for_status()
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_types.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_client.py def __init__(self, host: Optional[str] = None, **kwargs) -> None: super().__init__(httpx.Client, host, **kwargs) # ollama-pyt...
try: # try to parse content as JSON and extract 'error' # fallback to raw content if JSON parsing fails error = json.loads(error).get('error', error)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def speak(speaker, content): if speaker: p = await asyncio.create_subprocess_exec(speaker, content) ...
try: b64decode(image, validate=True) return image if isinstance(image, str) else image.decode('utf-8')
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_types.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_client.py def __init__(self, host: Optional[str] = None, **kwargs) -> None: super().__init__(httpx.Client, host, **kwargs) # ollama-pyt...
# try to parse content as JSON and extract 'error'
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_types.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_client.py def __init__(self, host: Optional[str] = None, **kwargs) -> None: super().__init__(httpx.Client, host, **kwargs) # ollama-pyt...
# fallback to raw content if JSON parsing fails
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def speak(speaker, content): if speaker: p = await asyncio.create_subprocess_exec(speaker, content) ...
except (binascii.Error, TypeError): ...
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
except ResponseError as e: if e.status_code != 404: raise with open(path, 'rb') as r: self._request('POST', f'/api/blobs/{digest}', content=r)
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
except httpx.HTTPStatusError as e: e.response.read() raise ResponseError(e.response.text, e.response.status_code) from None
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
except httpx.HTTPStatusError as e: e.response.read() raise ResponseError(e.response.text, e.response.status_code) from None
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def speak(speaker, content): if speaker: p = await asyncio.create_subprocess_exec(speaker, content) ...
except ResponseError as e: if e.status_code != 404: raise async def upload_bytes(): with open(path, 'rb') as r: while True: chunk = r.read(32 * 1024) if not chunk: break yield chunk await self._request('POST', f'/api/blobs/{...
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_types.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_client.py def __init__(self, host: Optional[str] = None, **kwargs) -> None: super().__init__(httpx.Client, host, **kwargs) # ollama-pyt...
except json.JSONDecodeError: ...
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
except httpx.HTTPStatusError as e: e.response.read() raise ResponseError(e.response.text, e.response.status_code) from None
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def main(): parser = argparse.ArgumentParser() parser.add_argument('--speak', default=False, action='sto...
for line in io.StringIO(modelfile): command, _, args = line.partition(' ') if command.upper() not in ['FROM', 'ADAPTER']: print(line, end='', file=out) continue path = Path(args.strip()).expanduser() path = path if path.is_absolute() else base / path if path.exists(): ...
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
for message in messages or []: if not isinstance(message, dict): raise TypeError('messages must be a list of strings') if not (role := message.get('role')) or role not in ['system', 'user', 'assistant']: raise RequestError('messages must contain a role and it must be one of "system", "user",...
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/ollama/_types.py def __init__(self, error: str, status_code: int = -1): try: # try to parse content as JSON and extract 'error' # f...
for line in r.iter_lines(): partial = json.loads(line) if e := partial.get('error'): raise ResponseError(e) yield partial
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>ollama-python/ollama/_client.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # ollama-python/examples/async-chat-stream/main.py async def main(): parser = argparse.ArgumentParser() parser.add_argument('--speak', default=False, action='sto...
for line in io.StringIO(modelfile): command, _, args = line.partition(' ') if command.upper() not in ['FROM', 'ADAPTER']: print(line, end='', file=out) continue path = Path(args.strip()).expanduser() path = path if path.is_absolute() else base / path if path.exists(): ...
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle