当前位置:   article > 正文

如何调用本地ollama的http请求接口_ollama接口调用

ollama接口调用

http://127.0.0.1:11434/api/generate

使用http post请求,参数

  1. {
  2. "model": "qwen",
  3. "prompt": "为什么天空是蓝色?",
  4. "stream": false
  5. }

返回结果如下:

  1. {
  2. "model": "qwen",
  3. "created_at": "2024-05-10T15:03:49.9029106Z",
  4. "response": "天空为什么是蓝色的呢?这是因为大气中的空气分子散射太阳光,其中波长较短的紫光和红光被大量吸收,而波长大于蓝光的黄光和橙光则通过少量的大气分子而散射出来。因此,在日出时,由于阳光需要穿过更长的大气层路径才能到达地面,所以光线在穿越大气层过程中被大量的空气分子所散射,使得太阳光中的颜色被分散,呈现出一种淡黄色的颜色。这就是为什么天空在日出时呈现为淡黄色的原因。",
  5. "done": true,
  6. "context": [
  7. 151644,
  8. 872,
  9. 198,
  10. 100678,
  11. 101916,
  12. 20412,
  13. 105681,
  14. 30,
  15. 151645,
  16. 198,
  17. 151644,
  18. 77091,
  19. 198,
  20. 101916,
  21. 100678,
  22. 20412,
  23. 105681,
  24. 9370,
  25. 101036,
  26. 11319,
  27. 109989,
  28. 105797,
  29. 101047,
  30. 100819,
  31. 102388,
  32. 99632,
  33. 99759,
  34. 101281,
  35. 99225,
  36. 3837,
  37. 90919,
  38. 99804,
  39. 45861,
  40. 99260,
  41. 99534,
  42. 9370,
  43. 101168,
  44. 99225,
  45. 33108,
  46. 99425,
  47. 99225,
  48. 99250,
  49. 100722,
  50. 104460,
  51. 3837,
  52. 68536,
  53. 99804,
  54. 102829,
  55. 34204,
  56. 100400,
  57. 99225,
  58. 9370,
  59. 99789,
  60. 99225,
  61. 33108,
  62. 107678,
  63. 99225,
  64. 46448,
  65. 67338,
  66. 108521,
  67. 104197,
  68. 99180,
  69. 102388,
  70. 68536,
  71. 99632,
  72. 99759,
  73. 99898,
  74. 1773,
  75. 101886,
  76. 3837,
  77. 18493,
  78. 8903,
  79. 20221,
  80. 13343,
  81. 3837,
  82. 101887,
  83. 104166,
  84. 85106,
  85. 109239,
  86. 33126,
  87. 45861,
  88. 104197,
  89. 99180,
  90. 99371,
  91. 76837,
  92. 101901,
  93. 104658,
  94. 104722,
  95. 3837,
  96. 99999,
  97. 109587,
  98. 18493,
  99. 106063,
  100. 105797,
  101. 99371,
  102. 101925,
  103. 99250,
  104. 101514,
  105. 100819,
  106. 102388,
  107. 31838,
  108. 99632,
  109. 99759,
  110. 3837,
  111. 104193,
  112. 101281,
  113. 99225,
  114. 101047,
  115. 102284,
  116. 99250,
  117. 105211,
  118. 3837,
  119. 107433,
  120. 101053,
  121. 99773,
  122. 106140,
  123. 108901,
  124. 1773,
  125. 104301,
  126. 100678,
  127. 101916,
  128. 18493,
  129. 8903,
  130. 20221,
  131. 13343,
  132. 104401,
  133. 17714,
  134. 99773,
  135. 106140,
  136. 104249,
  137. 1773
  138. ],
  139. "total_duration": 39132770800,
  140. "load_duration": 9506095200,
  141. "prompt_eval_count": 13,
  142. "prompt_eval_duration": 1913722000,
  143. "eval_count": 118,
  144. "eval_duration": 27710203000
  145. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/煮酒与君饮/article/detail/832843
推荐阅读
相关标签
  

闽ICP备14008679号