Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the function interface #341

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions examples/babyagi.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ def perform_task_ppt(objective: str, task: str):
"""


perform_task = text.function(model, perform_task_ppt)


#####################
# Create a new task #
#####################
Expand Down Expand Up @@ -67,9 +64,6 @@ def create_tasks_fmt(result: str) -> List[str]:
return task_list


create_tasks = text.function(model, create_tasks_ppt, create_tasks_fmt)


########################
# Prioritize new tasks #
########################
Expand Down Expand Up @@ -104,9 +98,6 @@ def prioritize_tasks_fmt(result: str):
return task_list


prioritize_tasks = text.function(model, prioritize_tasks_ppt, prioritize_tasks_fmt)


objective = "Becoming rich while doing nothing."
first_task = {
"task_id": 1,
Expand Down Expand Up @@ -134,18 +125,23 @@ def one_cycle(objective: str, task_list, next_task_id: int):
"""

task = task_list.popleft()
result = perform_task(objective, task)
new_tasks = create_tasks(

prompt = perform_task_ppt(objective, task)
result = model(prompt)

prompt = create_tasks_ppt(
objective, first_task["task_name"], result, [first_task["task_name"]]
)
new_tasks = model(prompt)

for task in new_tasks:
next_task_id += 1
task_list.append({"task_id": next_task_id, "task_name": task})

prioritized_tasks = prioritize_tasks(
prompt = prioritize_tasks_ppt(
objective, [task["task_name"] for task in task_list], next_task_id
)
prioritized_tasks = model(prompt)

return task, result, prioritized_tasks, next_task_id

Expand Down
10 changes: 3 additions & 7 deletions examples/math_generate_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ def execute_code(code):
return result


answer_with_code = text.function(
models.text_completion.openai("text-davinci-003"),
answer_with_code_prompt,
execute_code,
)

result = answer_with_code(question, examples)
prompt = answer_with_code_prompt(question, examples)
answer = models.text_completion.openai("text-davinci-003")(prompt)
result = execute_code(answer)
print(f"It takes Carla {result:.0f} minutes to download the file.")
1 change: 0 additions & 1 deletion outlines/text/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from .functions import function
from .generate import continuation
from .prompts import prompt, render
63 changes: 0 additions & 63 deletions outlines/text/functions.py

This file was deleted.

51 changes: 0 additions & 51 deletions tests/text/test_function.py

This file was deleted.

Loading