mirror of
https://github.com/katanemo/plano.git
synced 2026-06-17 15:25:17 +02:00
pending changes
This commit is contained in:
parent
7c987a10ae
commit
4f597c0be5
3 changed files with 19 additions and 23 deletions
|
|
@ -6,10 +6,10 @@ listener:
|
|||
|
||||
# Centralized way to manage LLMs, manage keys, retry logic, failover and limits in a central way
|
||||
llm_providers:
|
||||
- name: OpenAI
|
||||
provider: openai
|
||||
- name: gpt-4o
|
||||
access_key: $OPENAI_API_KEY
|
||||
model: gpt-4o-mini
|
||||
provider: openai
|
||||
model: gpt-4o
|
||||
default: true
|
||||
|
||||
# default system prompt used by all prompt targets
|
||||
|
|
@ -22,6 +22,7 @@ prompt_targets:
|
|||
endpoint:
|
||||
name: app_server
|
||||
path: /agent/get_profile
|
||||
http_method: POST
|
||||
parameters:
|
||||
- name: name
|
||||
type: str
|
||||
|
|
@ -50,6 +51,6 @@ endpoints:
|
|||
# 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: host.docker.internal:18080
|
||||
endpoint: host.docker.internal:18083
|
||||
# max time to wait for a connection to be established
|
||||
connect_timeout: 0.005s
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ services:
|
|||
ports:
|
||||
- "18080:8080"
|
||||
environment:
|
||||
# this is only because we are running the sample app in the same docker container environment as archgw
|
||||
# this is only because we are running the sample app in the same docker container environemtn as archgw
|
||||
- CHAT_COMPLETION_ENDPOINT=http://host.docker.internal:10000/v1
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
import os
|
||||
import json
|
||||
import gradio as gr
|
||||
import logging
|
||||
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from pydantic import BaseModel, Field
|
||||
from slack_sdk import WebClient
|
||||
from slack_sdk.errors import SlackApiError
|
||||
from common import create_gradio_app
|
||||
|
||||
# from common import create_gradio_app
|
||||
|
||||
app = FastAPI()
|
||||
profile_data = None
|
||||
|
|
@ -28,7 +27,7 @@ profile_dict = {
|
|||
# Define the request model
|
||||
class ProfileRequest(BaseModel):
|
||||
name: str
|
||||
interest: str
|
||||
interests: str = "professional"
|
||||
|
||||
|
||||
class ProfileResponse(BaseModel):
|
||||
|
|
@ -39,16 +38,22 @@ class SlackRequest(BaseModel):
|
|||
slack_message: str
|
||||
|
||||
|
||||
@app.get("/agenty/get_profile")
|
||||
@app.post("/agent/get_profile")
|
||||
def get_profile(request: ProfileRequest):
|
||||
name = request.name
|
||||
interests = request.interest
|
||||
interests = request.interests
|
||||
|
||||
if name not in profile_dict["name"]:
|
||||
if name not in profile_dict:
|
||||
details = f"Sorry I don't have any profile information for {name}. Looks like you'll have to chat with this person to get more info"
|
||||
else:
|
||||
profile_dict_details = profile_dict[name]
|
||||
|
||||
details = ""
|
||||
if interests == "personal":
|
||||
personal_details = profile_dict_details["personal"]
|
||||
details += f"Personal details {personal_details}."
|
||||
else:
|
||||
professional_details = profile_dict_details["professional"]
|
||||
details += f"Professional details {professional_details}."
|
||||
return details
|
||||
|
||||
|
||||
|
|
@ -77,15 +82,5 @@ def send_slack_message(request: SlackRequest):
|
|||
print(f"Error sending message: {e.response['error']}")
|
||||
|
||||
|
||||
CHAT_COMPLETION_ENDPOINT = os.getenv("CHAT_COMPLETION_ENDPOINT")
|
||||
client = OpenAI(
|
||||
api_key="--",
|
||||
base_url=CHAT_COMPLETION_ENDPOINT,
|
||||
)
|
||||
|
||||
gr.mount_gradio_app(
|
||||
app, create_gradio_app(demo_description, client), path="/agent/chat"
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue