Comments (1)
Hey @medoer! I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this together!
To resolve the HTML parsing error when building the Groq component, ensure that the HTML content is correctly formatted and that there are no syntax errors. In the provided code, there was a missing closing angle bracket in the last line of the content. Correcting this should help resolve the parsing error.
Here is the corrected content:
from typing import Optional
from langchain_groq import ChatGroq
from langflow.base.models.groq_constants import MODEL_NAMES
from pydantic.v1 import SecretStr
from langflow.base.constants import STREAM_INFO_TEXT
from langflow.base.models.model import LCModelComponent
from langflow.field_typing import Text
class GroqModel(LCModelComponent):
display_name: str = "Groq"
description: str = "Generate text using Groq."
icon = "Groq"
field_order = [
"groq_api_key",
"model",
"max_output_tokens",
"temperature",
"top_k",
"top_p",
"n",
"input_value",
"system_message",
"stream",
]
def build_config(self):
return {
"groq_api_key": {
"display_name": "Groq API Key",
"info": "API key for the Groq API.",
"password": True,
},
"groq_api_base": {
"display_name": "Groq API Base",
"info": "Base URL path for API requests, leave blank if not using a proxy or service emulator.",
"advanced": True,
},
"max_tokens": {
"display_name": "Max Output Tokens",
"info": "The maximum number of tokens to generate.",
"advanced": True,
},
"temperature": {
"display_name": "Temperature",
"info": "Run inference with this temperature. Must by in the closed interval [0.0, 1.0].",
},
"n": {
"display_name": "N",
"info": "Number of chat completions to generate for each prompt. Note that the API may not return the full n completions if duplicates are generated.",
"advanced": True,
},
"model_name": {
"display_name": "Model",
"info": "The name of the model to use. Supported examples: gemini-pro",
"options": MODEL_NAMES,
},
"input_value": {"display_name": "Input", "info": "The input to the model."},
"stream": {
"display_name": "Stream",
"info": STREAM_INFO_TEXT,
"advanced": True,
},
"system_message": {
"display_name": "System Message",
"info": "System message to pass to the model.",
"advanced": True,
},
}
def build(
self,
groq_api_key: str,
model_name: str,
input_value: Text,
groq_api_base: Optional[str] = None,
max_tokens: Optional[int] = None,
temperature: float = 0.1,
n: Optional[int] = 1,
stream: bool = False,
system_message: Optional[str] = None,
) -> Text:
output = ChatGroq(
model_name=model_name,
max_tokens=max_tokens or None, # type: ignore
temperature=temperature,
groq_api_base=groq_api_base,
n=n or 1,
groq_api_key=SecretStr(groq_api_key),
streaming=stream,
)
return self.get_chat_result(output, stream, input_value, system_message)
Make sure to replace the content in your project with the corrected version above [1].
Additionally, ensure you have the correct dependencies and versions required for the Groq component to function correctly:
langchain-groq = "^0.1.3"
pydantic = "^1.10.2"
These dependencies are specified in the pyproject.toml
file [2].
To continue talking to Dosu, mention @dosu.
from langflow.
Related Issues (20)
- Faiss search error HOT 2
- The outout of the Chat Input is not been recognized as text by OpenAI model HOT 4
- Error Building Component Error building Component Astra DB: {"errors":[{"message":"Request invalid: field 'command.name' value \"english-test\" not valid. Problem: must match \"[a-zA-Z][a-zA-Z0-9_]*\".","errorCode":"COMMAND_FIELD_INVALID"}]} HOT 1
- ValidationError: 2 validation errors for HumanMessage at v1.0.0a59 HOT 4
- Encountering error in building ASTRA DB Search node in the canvas. Error Building Component Error building Component Astra DB Search: Invalid inputs provided. HOT 4
- API Request ERROR HOT 3
- [Feature Request]: Allow local cassandra connections
- idea
- [Request] Please add openrouter as LLM Model
- Nested chats HOT 1
- Module langflow.inputs not found HOT 1
- CommandError: Multiple head revisions are present for given argument 'head'; please specify a specific target revision, '<branchname>@head' to narrow to a specific head, or 'heads' for all heads HOT 3
- Questions about Run Flow HOT 3
- Question: Hugging Face API HOT 1
- Issue with Chat Input component HOT 5
- Question: Inquiry on Session Management and Parameter Passing in Langflow API HOT 3
- Langflow Store Suspension HOT 1
- Documentation to use Flow as Tool HOT 3
- Method not Allowed on API HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from langflow.