Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #451 from Jaseci-Labs/removing-llm-packages
Browse files Browse the repository at this point in the history
[Chore] Removing LLM Packages from the Repo
  • Loading branch information
marsninja authored Jun 25, 2024
2 parents 5308975 + 1a04efe commit 0ca7f3d
Show file tree
Hide file tree
Showing 47 changed files with 72 additions and 972 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest
pip install pytest mtllm
- name: Run tests
run: pytest -x
18 changes: 6 additions & 12 deletions examples/genai/essay_review.jac
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import:py from jaclang.core.llms, Anthropic, Ollama, Groq;
import:py from mtllm.llms, OpenAI;

# glob llm = Anthropic(model_name="claude-3-sonnet-20240229");
# glob llm = Ollama(model_name="phi3");
glob llm = Groq();
glob llm = OpenAI();

obj Essay {
has essay: 'Essay': str;
has essay: str;

can 'Evaluate the given essay based on the given criteria. Provide Detailed Judgement.'
essay_judge(criteria: 'Criteria': str) -> 'Judgement': str by llm(incl_info=(self.essay));

can 'Generate a summary'
generate_summary(judgements: 'Judgements': dict) -> 'Summary': str by llm(incl_info=(self.essay));

can 'Give essay a letter grade (A-D)'
give_grade(summary: 'Summary': str) -> 'Grade': str by llm();
essay_judge(criteria: str) -> str by llm(incl_info=(self.essay));
can generate_summary(judgements: dict) -> str by llm(incl_info=(self.essay));
can give_grade(summary: str) -> 'A to D': str by llm();
}

with entry{
Expand Down
19 changes: 7 additions & 12 deletions examples/genai/expert_answer.jac
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import:py from jaclang.core.llms, Anthropic, Ollama, Groq;
import:py from mtllm.llms, OpenAI;

# glob llm = Anthropic(model_name="claude-3-sonnet-20240229");
# glob llm = Ollama(model_name="phi3");
glob llm = Groq();
glob llm = OpenAI();

can get_expert(question: str) -> 'Best Expert to Answer the Question': str by llm(method='Reason');
can get_answer(question: str, expert: str) -> str by llm();

can 'Finds the best professional to answer the given question'
get_expert(question: 'Question': str)-> 'Expert Profession': str by llm(reason=True);
can "Get the answer for the question from expert's perspective"
get_answer(question:'Question': str, expert: 'Expert': str)-> "Expert's Answer": str by llm(temperature=1.0);

with entry{
with entry {
question = "What are Large Language Models?";
expert = get_expert(question);
answer = get_answer(question, expert);
print(f"For instance, {expert} would answer '{answer}' for the question '{question}'");
}
print(f"{expert} says: '{answer}' ");
}
8 changes: 3 additions & 5 deletions examples/genai/grammar_checker.jac
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import:py from jaclang.core.llms, Anthropic;
import:py from mtllm.llms, OpenAI;

glob llm = Anthropic(model_name="claude-3-sonnet-20240229");
glob llm = OpenAI();

can "Resolve any grammar errors in the given text"
correct_grammar(text: 'Text with Errors': str) -> 'Grammar Corrected Text': str by llm(temperature=0.9);
can correct_grammar(text: str) -> 'Grammar Corrected Text': str by llm(temperature=0.9);

with entry {
#open the file and read the text
files_path = input("Enter the file path to the text file: ");
with open(files_path, 'r') as file {
text = file.read();
Expand Down
17 changes: 6 additions & 11 deletions examples/genai/joke_gen.jac
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import:py from jaclang.core.llms, Anthropic, Ollama, Groq;
import:py from mtllm.llms, OpenAI;

# glob llm = Anthropic(model_name="claude-3-sonnet-20240229");
# glob llm = Ollama(model_name="phi3");
glob llm = Groq();
glob llm = OpenAI();

obj "A list of good dad jokes. A indicates the punchline"
JokeList {
obj PunclineJokes {
has jokes: 'Jokes with Punchlines': list[dict] = [
{
"joke": "How does a penguin build its house?",
Expand All @@ -17,17 +14,15 @@ JokeList {
}
];

can 'Generate a Joke with a Punchline'
generate_joke_with_punchline -> 'Joke with Punchline':dict by llm(incl_info=(self.jokes), temperature=0.0);

can generate_joke -> 'NEW JOKE WITH A PUNCHLINE': dict by llm(incl_info=(self.jokes), temperature=0.0);
can generate {
joke_punchline = self.generate_joke_with_punchline();
joke_punchline = self.generate_joke();
self.jokes.append(joke_punchline);
}
}

with entry {
joke_gen = JokeList();
joke_gen = PunclineJokes();
for i in range(5) {joke_gen.generate();}
print(joke_gen.jokes);
}
36 changes: 0 additions & 36 deletions examples/genai/no_semstr/essay_review.jac

This file was deleted.

14 changes: 0 additions & 14 deletions examples/genai/no_semstr/expert_answer.jac

This file was deleted.

16 changes: 0 additions & 16 deletions examples/genai/no_semstr/grammar_checker.jac

This file was deleted.

29 changes: 0 additions & 29 deletions examples/genai/no_semstr/joke_gen.jac

This file was deleted.

26 changes: 0 additions & 26 deletions examples/genai/no_semstr/odd_word_out.jac

This file was deleted.

22 changes: 0 additions & 22 deletions examples/genai/no_semstr/personality_finder.jac

This file was deleted.

21 changes: 0 additions & 21 deletions examples/genai/no_semstr/text_to_type.jac

This file was deleted.

12 changes: 0 additions & 12 deletions examples/genai/no_semstr/translator.jac

This file was deleted.

36 changes: 9 additions & 27 deletions examples/genai/odd_word_out.jac
Original file line number Diff line number Diff line change
@@ -1,33 +1,15 @@
import:py from jaclang.core.llms, Anthropic, Ollama, Groq;
import:py from mtllm.llms, OpenAI;

# glob llm = Anthropic(model_name="claude-3-sonnet-20240229");
# glob llm = Ollama(model_name="phi3");
glob llm = Groq();
glob llm = OpenAI(model_name="gpt-4o");


glob examples: 'Examples for Picking Odd Word out': list[dict] = [
{
"OPTIONS": ["skirt", "dress", "pen", "jacket"],
"REASONING": "skirt is clothing, dress is clothing, pen is an object, jacket is clothing.",
"RESULT": "pen"
},
{
"OPTIONS": ["Spain", "France", "German", "England", "Singapore"],
"REASONING": "Spain is a country, France is a country, German is a language, ...",
"RESULT": "German"
}
glob examples: 'Examples for Picking Odd Word out (Options, Reasoing, Result)': list[tuple[list[str], str, str]] = [
(["skirt", "dress", "pen", "jacket"], "skirt is clothing, dress is clothing, pen is an object, jacket is clothing.", "pen"),
(["Spain", "France", "German", "England", "Singapore"], "Spain, France, England, Singapore is a country, German is a language.", "German")
];

can 'Pick only the Odd word out'
pick_odd_word_out_v1(options: 'Options to pick from': list[str]) -> 'RESULT': str
by llm(reason=True, incl_info=(examples));

can 'Pick the Odd word out with reasoning'
pick_odd_word_out_v2(options: 'Options to pick from': list[str]) -> 'OPTIONS, REASONING & RESULT': dict[str, any]
by llm(incl_info=(examples));
can 'Pick the Odd word out'
odd_word_out(options: 'Options to pick from': list[str]) -> 'REASONING & RESULT': tuple[str, str] by llm(incl_info=(examples));

with entry {
options = ["Bentley", "Ferrari", "Lamborghini", "Casio", "Toyota"];
print(pick_odd_word_out_v1(options));
print(pick_odd_word_out_v2(options));
}
print(odd_word_out(["Bentley", "Ferrari", "Lamborghini", "Casio", "Toyota"]));
}
6 changes: 2 additions & 4 deletions examples/genai/personality_finder.jac
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import:py from jaclang.core.llms, Anthropic, Ollama, Groq;
# glob llm = Anthropic(model_name="claude-3-sonnet-20240229");
# glob llm = Groq();
import:py from mtllm.llms, OpenAI;

glob llm = Ollama(model_name="phi3");
glob llm = OpenAI();

enum 'Personality of the Person'
Personality {
Expand Down
7 changes: 2 additions & 5 deletions examples/genai/text_to_type.jac
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import:py from jaclang.core.llms, Anthropic, Ollama, Groq;

# glob llm = Anthropic(model_name="claude-3-sonnet-20240229");
# glob llm = Ollama(model_name="phi3");
glob llm = Groq();
import:py from mtllm.llms, OpenAI;

glob llm = OpenAI();

obj 'Employer'
Employer {
Expand Down
7 changes: 2 additions & 5 deletions examples/genai/translator.jac
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import:py from jaclang.core.llms, Anthropic, Ollama, Groq;

# glob llm = Anthropic(model_name="claude-3-sonnet-20240229");
# glob llm = Ollama(model_name="phi3");
glob llm = Groq();
import:py from mtllm.llms, OpenAI;

glob llm = OpenAI();

can 'Translate English Representation to the given language'
translate(input: 'English Representation': str, lang: 'Desired Language': str = "French")
Expand Down
2 changes: 1 addition & 1 deletion examples/genai/vision/math_solver.jac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import:py from jaclang.core.llms, OpenAI;
import:py from mtllm.llms, OpenAI;
import:py from PIL, Image;

glob llm = OpenAI(verbose= True, model_name="gpt-4o");
Expand Down
2 changes: 1 addition & 1 deletion examples/genai/vision/personality_finder.jac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import:py from jaclang.core.llms, OpenAI;
import:py from mtllm.llms, OpenAI;
import:py from PIL, Image;

glob llm = OpenAI(model_name="gpt-4o");
Expand Down
Loading

0 comments on commit 0ca7f3d

Please sign in to comment.