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

[feature] Allow Using OpenAI-Compatible LLM API #215

Open
d8rt8v opened this issue Nov 5, 2024 · 1 comment
Open

[feature] Allow Using OpenAI-Compatible LLM API #215

d8rt8v opened this issue Nov 5, 2024 · 1 comment

Comments

@d8rt8v
Copy link

d8rt8v commented Nov 5, 2024

Currently, the llm function in ai/api/llms.py is created using ChatOpenAI from Langchain with a fixed endpoint for OpenAI.

To make the usage of AI in Briefier OSS more flexible and enable users to utilize other OpenAI-compatible LLM APIs (such as hosted or self-hosted models with OpenAI-compatible interfaces), we could allow specifying a custom base_url via other_args in Langchain's ChatOpenAI options.

llm = ChatOpenAI(
            temperature=0,
            verbose=False,
            openai_api_key=openai_api_key,
            model_name=model_id if model_id else config("OPENAI_DEFAULT_MODEL_NAME"),
        )

To make the endpoint customizable, allow accepting a base_url parameter in other_args, allowing users to set up their own OpenAI-compatible LLM endpoint and map this variable to .env. This would look something like:

llm = ChatOpenAI(
            temperature=0,
            verbose=False,
            openai_api_key=openai_api_key,
            model_name=model_id if model_id else config("OPENAI_DEFAULT_MODEL_NAME"),
            other_args={"base_url": custom_base_url} if custom_base_url else {}
        )
@d8rt8v d8rt8v changed the title Feature Request: Allow Using OpenAI-Compatible LLM API [feature] Allow Using OpenAI-Compatible LLM API Nov 5, 2024
@d8rt8v
Copy link
Author

d8rt8v commented Nov 18, 2024

@lucasfcosta would like to head if this feature somehow contradicts with briefer's non-free tier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant