Francisco Zanartu commited on
Commit
124eea0
·
1 Parent(s): d7ffc69

feat: switch from OpenAI to Google LLM for structured output in text classification

Browse files
Files changed (1) hide show
  1. src/api/apis.py +2 -2
src/api/apis.py CHANGED
@@ -3,7 +3,7 @@
3
  from pathlib import Path
4
  from langchain_core.prompts import PromptTemplate
5
  from pydantic import BaseModel, computed_field
6
- from ..llm.llms import google_llm, openai_llm
7
 
8
  # Construct the path to the cards.md file
9
  current_file_path = Path(__file__).resolve()
@@ -48,7 +48,7 @@ def classify_text(text: str) -> CategoryResponse:
48
  prompt = PromptTemplate.from_template(
49
  cards_prompt + "\n\nUser Query:\n{query}\n\nResponse:"
50
  )
51
- llm_with_structure = openai_llm.with_structured_output(CategoryResponse)
52
 
53
  chain = prompt | llm_with_structure
54
  response = chain.invoke({"query": text})
 
3
  from pathlib import Path
4
  from langchain_core.prompts import PromptTemplate
5
  from pydantic import BaseModel, computed_field
6
+ from ..llm.llms import google_llm
7
 
8
  # Construct the path to the cards.md file
9
  current_file_path = Path(__file__).resolve()
 
48
  prompt = PromptTemplate.from_template(
49
  cards_prompt + "\n\nUser Query:\n{query}\n\nResponse:"
50
  )
51
+ llm_with_structure = google_llm.with_structured_output(CategoryResponse)
52
 
53
  chain = prompt | llm_with_structure
54
  response = chain.invoke({"query": text})