Skip to content

Commit

Permalink
make fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ivarflakstad committed Apr 9, 2024
1 parent 7dce5fd commit d862e3c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
1 change: 0 additions & 1 deletion backend/app/database/redis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import random

import redis.asyncio as aioredis

Expand Down
7 changes: 4 additions & 3 deletions backend/app/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Load environment variables from .env file
import pydantic
from pydantic import SecretStr
from pydantic_settings import BaseSettings, SettingsConfigDict

Expand Down Expand Up @@ -142,8 +141,10 @@ class AIModelsSettings(BaseSettings):

class Settings(BaseSettings):
model_config = SettingsConfigDict(
extra='allow',
env_file=".env", env_file_encoding="utf-8", env_nested_delimiter="__"
extra="allow",
env_file=".env",
env_file_encoding="utf-8",
env_nested_delimiter="__",
)

postgres_engine: SecretStr
Expand Down
10 changes: 4 additions & 6 deletions backend/prompt_experimentation/pe_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import wandb
from dotenv import load_dotenv
from dspy.teleprompt import BootstrapFewShot
from pydantic import SecretStr
from tqdm import tqdm

from app.settings import Settings

settings = Settings()
Expand Down Expand Up @@ -70,8 +70,7 @@
"Communication and Education, Synthetic Biology, Systems Biology, Zoology": "2",
# bioarxiv
"3. useful only for retrieving the drug related information like molecular "
"weights,similarities,smile codes, target medicines, effects on other medicine":
"3",
"weights,similarities,smile codes, target medicines, effects on other medicine": "3",
# chembl
}

Expand All @@ -94,8 +93,7 @@

if args.llm == "gpt-3.5-turbo":
turbo = dspy.OpenAI(
model="gpt-3.5-turbo",
api_key=settings.openai.api_key.get_secret_value()
model="gpt-3.5-turbo", api_key=settings.openai.api_key.get_secret_value()
)
elif args.llm == "gemma-7b-it":
turbo = dspy.GROQ(
Expand Down Expand Up @@ -202,7 +200,7 @@ def metric(gold, pred, trace=None):
teleprompter = BootstrapFewShot(metric=metric)
compiled_rag = teleprompter.compile(Router_module(), trainset=total_data[:DEV_NUM])

for x in tqdm(total_data[DEV_NUM: DEV_NUM + 20]):
for x in tqdm(total_data[DEV_NUM : DEV_NUM + 20]):
pred = compiled_rag.generate_answer(question=x.question)
print(f"Question: {x.question}")
print(f"Predicted Answer: {pred.answer}")
Expand Down

0 comments on commit d862e3c

Please sign in to comment.