kitlangton / kitlangton/automaton

Usage question: how to use behind a proxy?

Open
#4 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
9
Forks
3
PR merge metrics
No merged PRs in 30d

Description

I had asked for help here: https://github.com/zio/zio-openai/issues/31 and followed the solution to provide my own custom ClientConfig for zio http.
But now I think the config issue is maybe more automaton specific, so I am opening this question here.

I am just trying to use the automaton behind a proxy.

When I try this:
```
val run = {
val url: URL = URL.fromString("http://10.0.2.2:3128")
.toOption
.getOrElse(URL.empty)
println(s"url: " + url )
val proxy = Proxy(url)
ChatService
.prompt[ActionService](
"Slack me a poem in the style of ee cummings about the weather. Also, what's 2156 + 2366."
)
.provide(
ChatService.live[ActionService],
ActionService.layer,
ClientConfig.live(
ClientConfig().proxy(proxy)
),
Client.fromConfig
)
}
```
It still simply does not use the proxy.
```
timestamp=2023-04-12T08:48:48.974431188Z level=ERROR thread=#zio-fiber-0 message="" cause="Exception in thread "zio-fiber-4" java.lang.Exception: Unknown(io.netty.channel.ConnectTimeoutException: connection timed out: api.openai.com/104.18.7.192:443)
```
Any ideas how I could configure the proxy otherwise?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start from the provided ChatService.prompt example and trace how ClientConfig.live and Client.fromConfig are used when connecting to api.openai.com. Reproduce the timeout with the supplied proxy URL and verify that a configured proxy is actually used and the request succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.