Skip to content

Commit

Permalink
Doc Update (#129)
Browse files Browse the repository at this point in the history
* init update

* Update terminology.rst

* fix the branch to create an index.html, and fix pre-commit issues

* Doc update

* made several changes to the docs after Shuguang's revision

* fixing pre-commit issues

* fixed the reference file to the final prompt config file

* added google analytics

---------

Co-authored-by: Salman Paracha <[email protected]>
  • Loading branch information
nehcgs and Salman Paracha authored Oct 6, 2024
1 parent 2a7b955 commit 5c75675
Show file tree
Hide file tree
Showing 49 changed files with 1,187 additions and 611 deletions.
5 changes: 4 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
sphinx_book_theme==1.1.3
sphinx_copybutton==0.5.2
sphinxawesome-theme
sphinx_sitemap
sphinx_design
sphinxawesome_theme
41 changes: 0 additions & 41 deletions docs/source/_config/getting-started.yml

This file was deleted.

72 changes: 0 additions & 72 deletions docs/source/_include/function_calling_flask.py

This file was deleted.

6 changes: 0 additions & 6 deletions docs/source/_include/intent_request_example.json

This file was deleted.

12 changes: 0 additions & 12 deletions docs/source/_include/intent_response_example.json

This file was deleted.

5 changes: 0 additions & 5 deletions docs/source/_static/css/arch.css

This file was deleted.

12 changes: 12 additions & 0 deletions docs/source/_templates/analytics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- _templates/analytics.html -->
{% if google_analytics_id %}
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ google_analytics_id }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', '{{ google_analytics_id }}');
</script>
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _arch_function_calling_agentic_guide:
.. _arch_agent_guide:

Agentic (Text-to-Action) Apps
Agentic Workflow
==============================

Arch helps you easily personalize your applications by calling application-specific (API) functions
Expand All @@ -11,11 +11,10 @@ claims to creating ad campaigns - via prompts.

Arch analyzes prompts, extracts critical information from prompts, engages in lightweight conversation with
the user to gather any missing parameters and makes API calls so that you can focus on writing business logic.
Arch does this via its purpose-built :ref:`Arch-FC LLM <llms_in_arch>` - the fastest (200ms p90 - 10x faser than GPT-4o)
Arch does this via its purpose-built :ref:`Arch-FC LLM <function_calling>` - the fastest (200ms p90 - 10x faser than GPT-4o)
and cheapest (100x than GPT-40) function-calling LLM that matches performance with frontier models.
______________________________________________________________________________________________

.. image:: /_static/img/function-calling-network-flow.jpg
.. image:: includes/agent/function-calling-flow.jpg
:width: 100%
:align: center

Expand All @@ -29,7 +28,7 @@ is how you would go about enabling this scenario with Arch:
Step 1: Define prompt targets with functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. literalinclude:: /_config/function-calling-network-agent.yml
.. literalinclude:: includes/agent/function-calling-agent.yaml
:language: yaml
:linenos:
:emphasize-lines: 16-37
Expand All @@ -40,10 +39,10 @@ Step 2: Process request parameters in Flask

Once the prompt targets are configured as above, handling those parameters is

.. literalinclude:: /_include/parameter_handling_flask.py
.. literalinclude:: includes/agent/parameter_handling.py
:language: python
:linenos:
:caption: Flask API example for parameter extraction via HTTP request parameters
:caption: Parameter handling with Flask

Parallel/ Multiple Function Calling
-----------------------------------
Expand All @@ -64,7 +63,7 @@ the user's intent.

Example of Multiple Prompt Targets in YAML:

.. literalinclude:: /_config/function-calling-network-agent.yml
.. literalinclude:: includes/agent/function-calling-agent.yaml
:language: yaml
:linenos:
:emphasize-lines: 16-37
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ listen:
address: 127.0.0.1 | 0.0.0.0
port_value: 8080 #If you configure port 443, you'll need to update the listener with tls_certificates

system_prompts:
- name: network_assistant
content: You are a network assistant that just offers facts about the operational health of the network
system_prompt: |
You are a network assistant that just offers facts; not advice on manufacturers or purchasing decisions.
llm_providers:
- name: "OpenAI"
access_key: $OPEN_AI_KEY
model: gpt-4o
default: true
- name: "OpenAI"
provider: "openai"
access_key: OPENAI_API_KEY
model: gpt-4o
stream: true

prompt_targets:
- name: reboot_devices
Expand All @@ -36,6 +36,12 @@ prompt_targets:
description: "The name of the device group to reboot."
required: false

prompt_endpoints:
- "http://127.0.0.2"
- "http://127.0.0.1"
# Arch creates a round-robin load balancing between different endpoints, managed via the cluster subsystem.
endpoints:
app_server:
# value could be ip address or a hostname with port
# this could also be a list of endpoints for load balancing
# for example endpoint: [ ip1:port, ip2:port ]
endpoint: "127.0.0.1:80"
# max time to wait for a connection to be established
connect_timeout: 0.005s
File renamed without changes.
41 changes: 41 additions & 0 deletions docs/source/build_with_arch/includes/rag/parameter_handling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/agent/device_summary', methods=['POST'])
def get_device_summary():
"""
Endpoint to retrieve device statistics based on device IDs and an optional time range.
"""
data = request.get_json()

# Validate 'device_ids' parameter
device_ids = data.get('device_ids')
if not device_ids or not isinstance(device_ids, list):
return jsonify({'error': "'device_ids' parameter is required and must be a list"}), 400

# Validate 'time_range' parameter (optional, defaults to 7)
time_range = data.get('time_range', 7)
if not isinstance(time_range, int):
return jsonify({'error': "'time_range' must be an integer"}), 400

# Simulate retrieving statistics for the given device IDs and time range
# In a real application, you would query your database or external service here
statistics = []
for device_id in device_ids:
# Placeholder for actual data retrieval
stats = {
'device_id': device_id,
'time_range': f'Last {time_range} days',
'data': f'Statistics data for device {device_id} over the last {time_range} days.'
}
statistics.append(stats)

response = {
'statistics': statistics
}

return jsonify(response), 200

if __name__ == '__main__':
app.run(debug=True)
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
version: "0.1-beta"
listener:
address: 127.0.0.1 | 0.0.0.0
port_value: 8080 #If you configure port 443, you'll need to update the listener with tls_certificates

system_prompts:
- name: network_assistant
content: You are a network assistant that just offers facts about the operational health of the network

llm_providers:
- name: "OpenAI"
access_key: $OPEN_AI_KEY
model: gpt-4o
default: true

prompt_targets:
- name: get_device_statistics
description: >
Expand All @@ -34,7 +19,3 @@ prompt_targets:
description: "The number of days in the past over which to retrieve device statistics. Defaults to 7 days if not specified."
required: false
default: 7

prompt_endpoints:
- "http://127.0.0.2"
- "http://127.0.0.1"
Loading

0 comments on commit 5c75675

Please sign in to comment.