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

Add an endpoint for service metadata and use it to configure the app #116

Merged
merged 9 commits into from
Dec 10, 2024

Conversation

JoshuaC215
Copy link
Owner

@JoshuaC215 JoshuaC215 commented Dec 5, 2024

This ended up being a big update!

  • Introduce schema.ServiceMetadata which describes available agents, models, and default values based on the configuration (e.g. available LLM API keys)
  • Introduce /info endpoint on the service to return the current metadata
  • Update the AgentClient to retrieve the metadata by default and store it at AgentClient.info for use
  • Update the Streamlit app to use the agent_client.info to set the available agents and models in the app settings
  • While I was at it, refactored the error handling in AgentClient to be more idiomatic / robust / specific, and updated the app to give cleaner errors when there are connectivity issues
  • Updated many tests to work based on all the changes above, and added tests for new functionality
  • Now, with the dynamic config I could write an e2e integration tests that runs the app and hits the deployed service across docker containers 🎉

Example output for GET http://{service}/info

{
  "agents": [
    {
      "key": "research-assistant",
      "description": "A research assistant for generating research papers."
    },
    {
      "key": "chatbot",
      "description": "A simple chatbot."
    }
  ],
  "models": [
    "gpt-4o-mini",
    "claude-3-haiku",
  ],
  "default_agent": "research-assistant",
  "default_model": "gpt-4o-mini"
}

Copy link

codecov bot commented Dec 5, 2024

Codecov Report

Attention: Patch coverage is 80.68182% with 34 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/core/settings.py 43.47% 13 Missing ⚠️
src/streamlit_app.py 70.00% 9 Missing ⚠️
src/client/client.py 92.50% 6 Missing ⚠️
src/run_client.py 0.00% 4 Missing ⚠️
src/agents/research_assistant.py 33.33% 2 Missing ⚠️
Files with missing lines Coverage Δ
src/agents/__init__.py 100.00% <100.00%> (ø)
src/agents/agents.py 100.00% <100.00%> (ø)
src/client/__init__.py 100.00% <100.00%> (ø)
src/schema/__init__.py 100.00% <ø> (ø)
src/schema/schema.py 85.45% <100.00%> (+2.47%) ⬆️
src/service/service.py 89.65% <100.00%> (+0.66%) ⬆️
src/agents/research_assistant.py 54.05% <33.33%> (-0.12%) ⬇️
src/run_client.py 0.00% <0.00%> (ø)
src/client/client.py 88.19% <92.50%> (-0.92%) ⬇️
src/streamlit_app.py 70.65% <70.00%> (-2.29%) ⬇️
... and 1 more

@JoshuaC215 JoshuaC215 merged commit 198b878 into main Dec 10, 2024
6 checks passed
@JoshuaC215 JoshuaC215 deleted the add-metadata-endpoint branch December 10, 2024 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant