Skip to content

Commit

Permalink
Formatting and dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
Florents-Tselai committed Jun 26, 2024
1 parent 6804f9b commit 5f9f5f8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 88 deletions.
42 changes: 0 additions & 42 deletions tests/conftest.py

This file was deleted.

45 changes: 0 additions & 45 deletions tests/test_tsellm.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,51 +103,6 @@ def test_embed_default_hazo(self):
out,
)

#
# def test_cli_prompt(existing_db_path):
# db = Database(existing_db_path)
#
# assert db.execute("select prompt from prompts").fetchall() == [
# ("hello world!",),
# ("how are you?",),
# ("is this real life?",),
# ("1+1=?",),
# ]
#
# cli(
# [
# existing_db_path,
# "UPDATE prompts SET generated_markov=prompt(prompt, 'markov')",
# ]
# )
#
# for prompt, generated_markov in db.execute(
# "select prompt, generated_markov from prompts"
# ).fetchall():
# words = generated_markov.strip().split()
# # Every word should be one of the original prompt (see https://github.com/simonw/llm-markov/blob/657ca504bcf9f0bfc1c6ee5fe838cde9a8976381/tests/test_llm_markov.py#L20)
# prompt_words = prompt.split()
# for word in words:
# assert word in prompt_words
#
# # cli(
# # [
# # existing_db_path,
# # "UPDATE prompts SET embedding=prompt(embed, 'dummy model')",
# # ]
# # )
#
#
# def test_cli_embed(existing_db_path):
# db = Database(existing_db_path)
#
# assert db.execute("select prompt from prompts").fetchall() == [
# ("hello world!",),
# ("how are you?",),
# ("is this real life?",),
# ("1+1=?",),
# ]


if __name__ == "__main__":
unittest.main()
8 changes: 7 additions & 1 deletion tsellm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@
def _prompt_model(prompt, model):
return llm.get_model(model).prompt(prompt).text()


def _prompt_model_default(prompt):
return llm.get_model("markov").prompt(prompt).text()


def _embed_model(text, model):
return json.dumps(llm.get_embedding_model(model).embed(text))


def _embed_model_default(text):
return json.dumps(llm.get_embedding_model(llm_cli.get_default_embedding_model()).embed(text))
return json.dumps(
llm.get_embedding_model(llm_cli.get_default_embedding_model()).embed(text)
)


def _tsellm_init(con):
"""Entry-point for tsellm initialization."""
Expand Down

0 comments on commit 5f9f5f8

Please sign in to comment.