yomorun / yomo

🦖 Stateful Serverless Framework for Geo-distributed Edge AI Infra
https://yomo.run
Apache License 2.0
1.64k stars 129 forks source link

feat: cli test prompt #760

Closed venjiang closed 4 months ago

venjiang commented 4 months ago

Description

Used to test ai sfn.

Usage

$ yomo test-prompt -h

Test LLM prompt

Usage:
  yomo test-prompt [flags]

Aliases:
  test-prompt, p

Flags:
  -a, --ai-server string       LLM API server address (default "http://localhost:8000")
  -h, --help                   help for test-prompt
      --sfn strings            sfn source directory
  -s, --system-prompt string   system prompt (default "You are a very helpful assistant. Your job is to choose the best possible action to solve the user question or task. Don't make assumptions about what values to plug into functions. Ask for clarification if a user request is ambiguous. If you don't know the answer, stop the conversation by saying \"no func call\"")
  -u, --user-prompt string     user prompt

Test llm-sfn-get-weather

$ yomo p --sfn ./llm-sfn-get-weather -u "What's the difference between the weather in Beijing and New York?"
ℹ️   --------------------------------------------------------
ℹ️   Run AI SFN on directory: .
ℹ️   Register AI function success
ℹ️   Invoke LLM API "http://localhost:8000/invoke"
ℹ️   >> LLM API Request
ℹ️   Messages:
ℹ️       System: You are a very helpful assistant. Your job is to choose the best possible action to solve the user question or task. Don't make assumptions about what values to plug into functions. Ask for clarification if a user request is ambiguous.
ℹ️       User: What's the difference between the weather in Beijing and New York?
ℹ️   << LLM API Response
ℹ️   Invoke functions[2]:
ℹ️       [call_LUD1TeeQhnh7DgOpEWBPEvub] tag: 17, name: get-weather, arguments: {"city_name": "Beijing"}, result: [Beijing] temperature: 25°C
ℹ️       [call_Ml5GMJNoJflFvloAIVFfn9eo] tag: 17, name: get-weather, arguments: {"city_name": "New York"}, result: [New York] temperature: 30°C
ℹ️   Finish Reason: stop
ℹ️   Content: The current temperature in Beijing is 25°C, while the temperature in New York is 30°C. This means that New York is currently 5°C warmer than Beijing.
vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **yomo** | ⬜️ Ignored ([Inspect](https://vercel.com/yomorun/yomo/6FrUdJhjJCLyJB7tFVWTWtJ6iSZH)) | [Visit Preview](https://yomo-git-feat-cli-test-prompt-yomorun.vercel.app) | | Mar 21, 2024 3:46pm |
codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 60.00000% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 64.80%. Comparing base (2372021) to head (597e359). Report is 2 commits behind head on master.

:exclamation: Current head 597e359 differs from pull request most recent head d132ba3. Consider uploading reports for the commit d132ba3 to get more accurate results

Files Patch % Lines
pkg/bridge/ai/provider/gemini/provider.go 0.00% 6 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #760 +/- ## ========================================== + Coverage 64.59% 64.80% +0.20% ========================================== Files 43 43 Lines 2497 2506 +9 ========================================== + Hits 1613 1624 +11 + Misses 770 768 -2 Partials 114 114 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.