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

Expose the HttpClient to allow proxies etc #39

Open
yschimke opened this issue Jan 8, 2024 · 1 comment
Open

Expose the HttpClient to allow proxies etc #39

yschimke opened this issue Jan 8, 2024 · 1 comment
Assignees
Labels
component:android sdk Issue/PR related to Android SDK status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working

Comments

@yschimke
Copy link

yschimke commented Jan 8, 2024

https://github.com/google/generative-ai-android/blob/7043908ce793a6d424f8c10985d4654bc1b010e5/generativeai/src/main/java/com/google/ai/client/generativeai/internal/api/APIController.kt#L71

Doesn't allow changing the HttpClient, for example adding logging, or configuring a proxy.

Ideally a Ktor engine could be passed in, or if not possible a OkHttp Call.Factory.

@yschimke
Copy link
Author

My current workaround is

@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "EXPOSED_FUNCTION_RETURN_TYPE", "EXPOSED_PARAMETER_TYPE")
GenerativeModel(
        modelName = "gemini-pro",
        apiKey = BuildConfig.GEMINI_API_KEY,
        generationConfig = config,
        controller = com.google.ai.client.generativeai.internal.api.APIController(
            key = BuildConfig.GEMINI_API_KEY,
            model = "gemini-pro",
            httpEngine = OkHttp.create {
                proxy = Proxy(Proxy.Type.HTTP, InetSocketAddress("10.0.2.2", 3125))
            }
        )
    )

@singhniraj08 singhniraj08 added type:bug Something isn't working component:android sdk Issue/PR related to Android SDK status:triaged Issue/PR triaged to the corresponding sub-team labels Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:android sdk Issue/PR related to Android SDK status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants