Removing langchain api and replacing with original api for all llms#84
Removing langchain api and replacing with original api for all llms#84AdvH039 wants to merge 3 commits intoaiplanethub:mainfrom
Conversation
|
@tarun-aiplanet please let me know you're happy with the implementation and if I can proceed the same with other llms. Thank you. |
|
Hi @AdvH039 Thanks for the PR. This is something similar we need. I will test it for Groq. Can you add for 2 more LLMs, so that we can test it at same time for 3 LLMs |
| model_name = self.config.model_name, | ||
| groq_api_key = self.config.groq_api_key, | ||
| temperature = self.config.temperature | ||
| self.llm = Groq( |
There was a problem hiding this comment.
Try to keep this code within try-except. If API key is not detected, an exception needs to be triggered
|
@tarun-aiplanet I added two more llms and used try-except. Please let me know if it's working. Thanks. |
| @@ -1,14 +1,11 @@ | |||
| from typing import Any | |||
| from langchain_core.messages import HumanMessage | |||
| from groq import Groq | |||
There was a problem hiding this comment.
import groq under the exception block. or you can also import it under load function.
Refer: https://github.com/aiplanethub/beyondllm/blob/main/src/beyondllm/llms/chatgroq.py
| return resp.content | ||
|
|
||
| try: | ||
| chat_completion = self.llm.chat.completions.create( |
There was a problem hiding this comment.
Actually Langchain internally have Human messages which has the system prompt. Would you add an system prompt as well.
cool. this looks good. the import statement and system prompt needs to fixed. |
|
@tarun-aiplanet Done. Thanks. |
|
@AdvH039 |
Refer #79