|
|
本帖最后由 nanimarcus 于 2025-2-2 19:41 编辑 * C1 b& Q/ h. Z3 V' {. i
: `* b* n; G- w) y, g================
^2 \; g( F2 e9 d! I5 GNvidia NIM service, deepseek :
- O5 x1 V7 S9 y6 ~( M e5 k0 B================6 T" D8 F- m9 I5 g/ s8 P' X
https://build.nvidia.com/deepseek-ai/deepseek-r1
- O! A! L7 ?9 Q) t1 F0 w; H8 X. a( `
' ]- ]" }% a0 k' i
from openai import OpenAI
& O u% e& `7 A m3 W# W6 I& x/ q- N6 r T7 V
client = OpenAI(, t# \! a5 P: X# E! E, f8 T
base_url = "https://integrate.api.nvidia.com/v1",6 A2 N( N) J2 O
api_key = "$API_KEY_REQUIRED_IF_EXECUTING_OUTSIDE_NGC"" {: D d( U3 m! H% w8 `( E+ F M g! Y: U
)
1 x1 u8 x5 x) Z! l! X# \! a% |
$ g! y6 J: u, Z- V0 w# _3 {completion = client.chat.completions.create(: Q$ ?9 i: x- G N- S
model="deepseek-ai/deepseek-r1",
7 ~ W5 y# ^4 O messages=[{"role":"user","content":"Which number is larger, 9.11 or 9.8?"}],; L$ p& d R/ T# {- z
temperature=0.6,- d7 p# U0 [, P9 v
top_p=0.7,
, L& D' I; d4 A/ `# \5 r0 g7 n max_tokens=4096,# F2 A; s9 f6 k* z
stream=True
0 h: }+ |/ r2 V0 x; k2 E5 P: Y)
* a2 k( F$ \4 ?% D5 N3 z8 f, j
2 ^" _9 Q. I- q; }for chunk in completion:2 m( W3 P+ {( a
if chunk.choices[0].delta.content is not None:
, D+ l+ T3 ?/ ` t' R4 h print(chunk.choices[0].delta.content, end=""). H" V2 A6 J& _$ o* K( h+ G
* r @, i' e" B; N4 k* k3 h
================+ N+ C$ Y9 m3 @3 |/ Y
Chat Deepseek
. I, g; K* M3 a! g# c================( e, x. `( r) V+ _/ D
$ v! D' V4 [0 h3 Z# n4 m
Which number is larger, 9.11 or 9.8?
( o4 `, {. _6 y2 Y! G- Y4 @ g1 Y! t8 _3 |3 V2 I& t0 f! l
To determine which number is larger between 9.11 and 9.8, let's compare them step by step.1 n' R. p# O4 b) K U' d3 W
. H) Q. Z$ [" ]. d+ t# D: `1 n Compare the Whole Number Parts:" M" N4 i& e6 w, n7 L
" C# h$ A: M4 F5 G3 u- d Both numbers have the same whole number part: 9.- C2 i- f' K. y- j0 |
# e! ~# R; Y! E, c" |$ x
Compare the Decimal Parts:
! p ^3 J0 n: [+ o _/ o$ n5 l1 [# L6 Q% C3 o ?+ @9 n
9.11 has a decimal part of 0.11.: d8 F7 c+ G, _7 b- I
8 L7 A# {$ C1 y3 g8 ~2 R* A7 I
9.8 can be written as 9.80 to have the same number of decimal places.
' n2 N) R/ S9 W& [6 j' Z* k, Z
6 R8 H% Q- s1 G* _) | Now, compare 0.11 and 0.80:
# |" [+ }+ \1 J/ j+ `- p! X! X
0 c; L' r3 a4 g 0.80 is greater than 0.11.$ Q1 J4 X4 K* a, w4 J" n7 u$ T( l
' A- z( S" C+ S8 ]% U
Conclusion:
, V, R# x* w( Z) J' c$ Z( q; c) A; s) v H! _4 ^( F0 d
Since the decimal part of 9.8 is larger than that of 9.11, the entire number 9.8 is larger. ?, C, h9 @8 k* T% ~
, {0 S; y; E, h& I/ f
9.8 is larger
5 C0 L! G8 i# C7 ]
/ V+ T; K7 q/ }7 \================
' E g; A/ _5 r$ Y1 H- f2 [: ~& @Chat OpenAI, Reason
0 h/ y/ y& b6 e* e* v) e================/ V4 ~6 Z- r c4 ?
* P: w8 o0 O/ a$ s+ O
To determine which number is larger, we compare the two numbers digit by digit:
* M+ {3 o" C& ^
- D" u8 M, \3 @" @% y* [1. Both numbers have the same whole number part (9).
5 a* U H; l. I# }, G( K) H2. Next, look at the decimal parts:
, P3 ~* z$ d; Y, t7 w* @ - For 9.11, the tenths digit is 1.4 f! F: A% T6 z
- For 9.8, the tenths digit is 8 (which can be thought of as 9.80).
) q q6 ]2 g/ Y3. Since 8 is greater than 1, 9.8 is larger than 9.11.6 C, D2 l3 e6 \" N7 U G
; a! T" y3 P( @5 O& `; eTherefore, **9.8 is larger than 9.11**.
! w" ]" l8 C8 Z3 F& l% x# F |
评分
-
查看全部评分
|