Skip to content

Commit

Permalink
Merge pull request #28 from neo4j-field/add-gemini
Browse files Browse the repository at this point in the history
add gemini to backend
  • Loading branch information
a-s-g93 authored Mar 12, 2024
2 parents 022bdfc + 306323c commit 4bdd8b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/app/backend/routers/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async def get_response(question: Question, background_tasks: BackgroundTasks) ->
context = reader.retrieve_context_documents(question_embedding=question_embedding, number_of_context_documents=question.number_of_documents)
# print(context)
print("context retrieved...")
llm = LLM(llm_type="GPT-4 8k", temperature=question.temperature)
llm = LLM(llm_type=question.llm_type, temperature=question.temperature)
print("llm initialized...")
llm_response = llm.get_response(question=question.question, context=context)
print("response retrieved...")
Expand Down
6 changes: 5 additions & 1 deletion src/main/app/backend/tools/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
from typing import List, Dict, Tuple

import openai
from langchain_community.chat_models import ChatVertexAI, AzureChatOpenAI
from langchain_community.chat_models import AzureChatOpenAI
# from langchain_google_genai import ChatGoogleGenerativeAI
from langchain_google_vertexai import ChatVertexAI
from langchain_openai import OpenAI
# from langchain.chains import ConversationChain
import pandas as pd
Expand Down Expand Up @@ -51,6 +53,8 @@ def _init_llm(self, llm_type: str, temperature: float):
top_p=0.95, # default is 0.95
top_k = 40 # default is 40
)
case "Gemini":
self.llm_instance = ChatVertexAI(model_name="gemini-pro")
case "GPT-4 8k":
# Tokens per Minute Rate Limit (thousands): 10
# Rate limit (Tokens per minute): 10000
Expand Down

0 comments on commit 4bdd8b0

Please sign in to comment.