wt002 commited on
Commit
f1d6b50
·
verified ·
1 Parent(s): 8dfe53b

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +16 -4
agent.py CHANGED
@@ -464,12 +464,24 @@ hf_token = os.getenv("HF_TOKEN")
464
 
465
 
466
  # Initialize the desired model and parameters
467
- llm = LiteLLMModel(
468
- model_id="gemini/gemini-2.0-flash",
469
- api_key=os.getenv("GEMINI_API_KEY"),
470
- max_tokens=8192
 
 
 
 
 
 
 
 
 
471
  )
472
 
 
 
 
473
 
474
 
475
  # Initialize the LangChain agent with the tool(s) and the model
 
464
 
465
 
466
  # Initialize the desired model and parameters
467
+ model_name = "mistralai/Mistral-7B-Instruct-v0.1"
468
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
469
+ model = AutoModelForCausalLM.from_pretrained(model_name)
470
+
471
+ # Create a text generation pipeline
472
+ pipe = pipeline(
473
+ "text-generation",
474
+ model=model,
475
+ tokenizer=tokenizer,
476
+ max_new_tokens=512,
477
+ temperature=0.7,
478
+ top_p=0.95,
479
+ repetition_penalty=1.15
480
  )
481
 
482
+ # Create LangChain LLM wrapper
483
+ llm = HuggingFacePipeline(pipeline=pipe)
484
+
485
 
486
 
487
  # Initialize the LangChain agent with the tool(s) and the model