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

I need to serve to 0.0.0.0 #3432

Open
engrogerio opened this issue Jun 18, 2024 · 3 comments
Open

I need to serve to 0.0.0.0 #3432

engrogerio opened this issue Jun 18, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@engrogerio
Copy link

engrogerio commented Jun 18, 2024

I can not serve to host 0.0.0.0.

Is that possible to implement a easy way to change constant.PF_SERVICE_HOST to another value?
Today if you change _constant.PF_SERVICE_HOST, it will be overwritten to 127.0.0.1 before the server starts.

@engrogerio engrogerio added the enhancement New feature or request label Jun 18, 2024
@YingChen1996
Copy link
Contributor

YingChen1996 commented Jun 20, 2024

@engrogerio ,Thanks for reporting the issue.
May I double confirm the scenario you mentioned above is local prompt flow service (pf service start) or prompt flow serve (pf flow serve)? And may I ask how do you change the PF_SERVICE_HOST, do you modify the corresponding source code?

Btw, in what scenarios do you need to change the host value?

@engrogerio
Copy link
Author

My code starts the trace :

@trace
def chat(question: str = "What's the capital of France?") -> str:
    """Flow entry function."""

    if "OPENAI_API_KEY" not in os.environ and "AZURE_OPENAI_API_KEY" not in os.environ:
        # load environment variables from .env file
        load_dotenv()
    prompty = Prompty.load(source=BASE_DIR / "chat.prompty")
    # trigger a llm call with the prompty obj
    output = prompty(question=question)
    return output

I changed the PF_SERVICE_HOST like:

constants_file_path = os.path.abspath(promptflow.constants.__file__)
command = f'sudo chmod 755 {constants_file_path}'
exit_status = os.system(command)

search_and_replace(constants_file_path, 'PF_SERVICE_HOST = "127.0.0.1"', 'PF_SERVICE_HOST = "0.0.0.0"')

My scenario is: I am using promptflow on a Posit Connect deployed application.

@YingChen1996
Copy link
Contributor

YingChen1996 commented Jun 26, 2024

Hi, @engrogerio , you may need change your code to constants_file_path = os.path.abspath(promptflow._sdk._constants.__file__) if you want to change PF_SERVICE_HOST in the source code. Btw, we will support config host in the future.

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

No branches or pull requests

2 participants