Vijayanand Sankarasubramanian commited on
Commit
a2558c3
·
1 Parent(s): b29a8c2

fixed llama3 to use huggingface model

Browse files
Files changed (1) hide show
  1. helpers/model_utils.py +5 -5
helpers/model_utils.py CHANGED
@@ -1,12 +1,12 @@
1
  from langchain_openai import OpenAI
2
  from langchain_anthropic import ChatAnthropic
3
- from langchain_community.llms import Ollama
4
- from helpers.import_envs import openai_api_key, anthropic_api_key
5
  from langchain_openai import ChatOpenAI
 
6
 
7
  GPT3 = "gpt-3.5"
8
  GPT4 = "gpt-4o"
9
- LLAMA3 = "Llama3"
10
  ANTHROPIC2 = "Claude-2.1"
11
 
12
  def _set_llm_based_on_choice(choice):
@@ -20,8 +20,8 @@ def _set_llm_based_on_choice(choice):
20
  model_name = "claude-2.1"
21
  llm = ChatAnthropic(model_name=model_name, anthropic_api_key=anthropic_api_key)
22
  elif choice == LLAMA3:
23
- model_name = "llama3"
24
- llm = Ollama(model=model_name)
25
  else:
26
  model_name = "gpt-3.5-turbo"
27
  llm = ChatOpenAI(model=model_name, temperature=0, api_key=openai_api_key)
 
1
  from langchain_openai import OpenAI
2
  from langchain_anthropic import ChatAnthropic
3
+ from helpers.import_envs import openai_api_key, anthropic_api_key, huggingface_token
 
4
  from langchain_openai import ChatOpenAI
5
+ from transformers.pipelines import pipeline
6
 
7
  GPT3 = "gpt-3.5"
8
  GPT4 = "gpt-4o"
9
+ LLAMA3 = "meta-llama/Meta-Llama-3-8B"
10
  ANTHROPIC2 = "Claude-2.1"
11
 
12
  def _set_llm_based_on_choice(choice):
 
20
  model_name = "claude-2.1"
21
  llm = ChatAnthropic(model_name=model_name, anthropic_api_key=anthropic_api_key)
22
  elif choice == LLAMA3:
23
+ model_name = LLAMA3
24
+ llm = pipeline("text-generation", model=model_name, token=huggingface_token)
25
  else:
26
  model_name = "gpt-3.5-turbo"
27
  llm = ChatOpenAI(model=model_name, temperature=0, api_key=openai_api_key)