Spaces:
Running
Running
Create module for llm api
Browse files
llm_api/__init__.py
ADDED
|
File without changes
|
meal_planner_api/connect_llm_api.py → llm_api/connect.py
RENAMED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
import utils
|
| 2 |
import google.generativeai as genai
|
| 3 |
-
from
|
| 4 |
|
| 5 |
|
| 6 |
def generate_content(text: str):
|
|
@@ -10,6 +10,6 @@ def generate_content(text: str):
|
|
| 10 |
|
| 11 |
|
| 12 |
def connect():
|
| 13 |
-
genai.configure(api_key=API_KEY)
|
| 14 |
model = genai.GenerativeModel('gemini-pro')
|
| 15 |
return model
|
|
|
|
| 1 |
+
from meal_planner_api import utils
|
| 2 |
import google.generativeai as genai
|
| 3 |
+
from meal_planner_api import config
|
| 4 |
|
| 5 |
|
| 6 |
def generate_content(text: str):
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
def connect():
|
| 13 |
+
genai.configure(api_key=config.API_KEY)
|
| 14 |
model = genai.GenerativeModel('gemini-pro')
|
| 15 |
return model
|
meal_planner_api/create_meal_plan.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import
|
| 2 |
from utils import to_markdown
|
| 3 |
|
| 4 |
|
|
@@ -7,7 +7,7 @@ def generate(parameters):
|
|
| 7 |
prompt = create_prompt(**parameters)
|
| 8 |
|
| 9 |
# Call your API or logic to generate the meal plan based on the prompt
|
| 10 |
-
meal_plan =
|
| 11 |
|
| 12 |
return to_markdown(prompt+'/n*******/n'+meal_plan)
|
| 13 |
|
|
|
|
| 1 |
+
from llm_api import connect
|
| 2 |
from utils import to_markdown
|
| 3 |
|
| 4 |
|
|
|
|
| 7 |
prompt = create_prompt(**parameters)
|
| 8 |
|
| 9 |
# Call your API or logic to generate the meal plan based on the prompt
|
| 10 |
+
meal_plan = connect.generate_content(prompt)
|
| 11 |
|
| 12 |
return to_markdown(prompt+'/n*******/n'+meal_plan)
|
| 13 |
|