Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
okdshin committed Dec 9, 2023
1 parent 4c0a2be commit db786f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions flatline_lsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,14 @@ def completions(
document = ls.workspace.get_text_document(params.text_document.uri)
line_index = params.position.line
character_index = params.position.character
assert lm_for_completion is not None
if lm_for_completion is not None:
max_context_lines = lm_for_completion.max_context_lines
else:
max_context_lines = 4
prompt = "".join(
list(
document.lines[
max(0, line_index - lm_for_completion.max_context_lines) : line_index
max(0, line_index - max_context_lines) : line_index
]
)
+ [document.lines[line_index][:character_index]]
Expand Down
4 changes: 4 additions & 0 deletions tests/test_language_model_for_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def test_language_model_for_completion():
lm_for_completion = flatline_lsp.LanguageModelForCompletion(
lang_server=server,
max_new_tokens=32,
min_new_tokens=16,
max_context_lines=4,
max_new_lines=2,
max_context_tokens=128,
tokenizer=tokenizer,
model=model,
)
Expand Down

0 comments on commit db786f7

Please sign in to comment.