Custom Model Name for Open AI APIs #6814
Replies: 1 comment 2 replies
-
|
@mohammadaghanoori Hello there! I'm here to assist you with bugs, questions, and contributions while you wait for a human maintainer. To use your own model name with the OpenAPI component in Langflow, make sure your model object has one of the following attributes: def get_model_name(llm, display_name: str | None = "Custom"):
attributes_to_check = ["model_name", "model", "model_id", "deployment_name"]
# Use a generator expression with next() to find the first matching attribute
model_name = next((getattr(llm, attr) for attr in attributes_to_check if hasattr(llm, attr)), None)
# If no matching attribute is found, return the class name as a fallback
return model_name if model_name is not None else display_nameEnsure your model object has one of these attributes set to your desired model name [1]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How can I use my own model name when using the OpenAPI component in Langflow? I want to use my custom model with an API and need to ensure it is correctly recognized within Langflow.
Beta Was this translation helpful? Give feedback.
All reactions