Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AdvH039
Copy link
Contributor

@AdvH039 AdvH039 commented Oct 26, 2024

Refer #79

@AdvH039
Copy link
Contributor Author

AdvH039 commented Oct 27, 2024

@tarun-aiplanet please let me know you're happy with the implementation and if I can proceed the same with other llms. Thank you.

@tarun-aiplanet
Copy link
Member

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(
Copy link
Member

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

@AdvH039
Copy link
Contributor Author

AdvH039 commented Oct 28, 2024

@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
Copy link
Member

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(
Copy link
Member

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.

@tarun-aiplanet
Copy link
Member

@tarun-aiplanet I added two more llms and used try-except. Please let me know if it's working. Thanks.

cool. this looks good. the import statement and system prompt needs to fixed.

@AdvH039
Copy link
Contributor Author

AdvH039 commented Oct 28, 2024

@tarun-aiplanet Done. Thanks.

@tarun-aiplanet tarun-aiplanet added enhancement New feature or request hacktoberfest-accepted Hacktoberfest 2024 acccepted labels Oct 29, 2024
@shivaya-aiplanet
Copy link
Contributor

@AdvH039
Congrats on being approved for the Hacktoberfest swags! Please share your details with me so we can send it over to you.
You can either drop the details in our Discord channel: bit.ly/aiplanet-discord or email me at [email protected].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest-accepted Hacktoberfest 2024 acccepted
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants