Skip to content

Commit ad5a10c

Browse files
committed
pass the server name to reach remote deployments
1 parent 50599c3 commit ad5a10c

File tree

6 files changed

+63
-9
lines changed

6 files changed

+63
-9
lines changed

Diff for: README.md

-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ $ docker run --rm -p 1416:1416 -v $PWD/pipelines:/opt/pipelines "deepset/hayhook
167167
At this stage Hayhooks is just a prototype, the natural next steps would be:
168168

169169
- Improve server configuration management (easy)
170-
- Add CLI configuration profiles, so it's easy to address different servers (easy)
171170
- Manage pipeline dependencies: one way could be adding the required packages in the pipeline's metadata and let the
172171
server handle installation (complex)
173172

Diff for: src/hayhooks/cli/__init__.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111

1212
@click.group(context_settings={"help_option_names": ["-h", "--help"]}, invoke_without_command=True)
1313
@click.version_option(prog_name="Hayhooks")
14-
def hayhooks():
15-
pass
14+
@click.option('--server', default="http://localhost:1416")
15+
@click.pass_context
16+
def hayhooks(ctx, server):
17+
ctx.obj = server
1618

1719

1820
hayhooks.add_command(run)

Diff for: src/hayhooks/cli/deploy/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55

66

77
@click.command()
8+
@click.pass_obj
89
@click.option('-n', '--name')
910
@click.argument('pipeline_file', type=click.File('r'))
10-
def deploy(name, pipeline_file):
11+
def deploy(server, name, pipeline_file):
1112
if name is None:
1213
name = Path(pipeline_file.name).stem
13-
resp = requests.post("http://localhost:1416/deploy", json={"name": name, "source_code": str(pipeline_file.read())})
14+
resp = requests.post(f"{server}/deploy", json={"name": name, "source_code": str(pipeline_file.read())})
1415

1516
if resp.status_code >= 400:
1617
click.echo(f"Error deploying pipeline: {resp.json().get('detail')}")

Diff for: src/hayhooks/cli/status/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55

66
@click.command()
7-
def status():
7+
@click.pass_obj
8+
def status(server):
89
try:
9-
r = requests.get("http://localhost:1416/status")
10+
r = requests.get(f"{server}/status")
1011
except ConnectionError:
1112
click.echo("Hayhooks server is not responding. To start one, run `hayooks run`")
1213
return

Diff for: src/hayhooks/cli/undeploy/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66

77

88
@click.command()
9+
@click.pass_obj
910
@click.argument('pipeline_name')
10-
def undeploy(pipeline_name):
11+
def undeploy(server, pipeline_name):
1112
try:
12-
resp = requests.post(f"http://localhost:1416/undeploy/{pipeline_name}")
13+
resp = requests.post(f"{server}/undeploy/{pipeline_name}")
1314

1415
if resp.status_code >= 400:
1516
click.echo(f"Cannot undeploy pipeline: {resp.json().get('detail')}")

Diff for: tests/test_files/chat_with_website.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
components:
2+
converter:
3+
init_parameters:
4+
extractor_type: DefaultExtractor
5+
type: haystack.components.converters.html.HTMLToDocument
6+
7+
fetcher:
8+
init_parameters:
9+
raise_on_failure: true
10+
retry_attempts: 2
11+
timeout: 3
12+
user_agents:
13+
- haystack/LinkContentFetcher/2.0.0b8
14+
type: haystack.components.fetchers.link_content.LinkContentFetcher
15+
16+
llm:
17+
init_parameters:
18+
api_base_url: null
19+
api_key:
20+
env_vars:
21+
- OPENAI_API_KEY
22+
strict: true
23+
type: env_var
24+
generation_kwargs: {}
25+
model: gpt-3.5-turbo
26+
streaming_callback: null
27+
system_prompt: null
28+
type: haystack.components.generators.openai.OpenAIGenerator
29+
30+
prompt:
31+
init_parameters:
32+
template: |
33+
"According to the contents of this website:
34+
{% for document in documents %}
35+
{{document.content}}
36+
{% endfor %}
37+
Answer the given question: {{query}}
38+
Answer:
39+
"
40+
type: haystack.components.builders.prompt_builder.PromptBuilder
41+
42+
connections:
43+
- receiver: converter.sources
44+
sender: fetcher.streams
45+
- receiver: prompt.documents
46+
sender: converter.documents
47+
- receiver: llm.prompt
48+
sender: prompt.prompt
49+
50+
metadata: {}

0 commit comments

Comments
 (0)