-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing langchain api and replacing with original api for all llms #84
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
src/openagi/llms/groq.py
Outdated
@@ -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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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